feat(logging): Add numeric elapsed time field elapsed_secs as f64 (#3004)

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
This commit is contained in:
iamjpotts 2024-02-12 15:51:55 -06:00 committed by GitHub
parent 84d576004c
commit d7cbf940c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -124,7 +124,10 @@ impl<'q> QueryLogger<'q> {
db.statement = sql,
rows_affected = self.rows_affected,
rows_returned = self.rows_returned,
// Human-friendly - includes units (usually ms). Also kept for backward compatibility
?elapsed,
// Search friendly - numeric
elapsed_secs = elapsed.as_secs_f64(),
// When logging to JSON, one can trigger alerts from the presence of this field.
slow_threshold=?self.settings.slow_statements_duration,
// Make sure to use "slow" in the message as that's likely
@ -139,7 +142,10 @@ impl<'q> QueryLogger<'q> {
db.statement = sql,
rows_affected = self.rows_affected,
rows_returned = self.rows_returned,
// Human-friendly - includes units (usually ms). Also kept for backward compatibility
?elapsed,
// Search friendly - numeric
elapsed_secs = elapsed.as_secs_f64(),
);
}
}