-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(logging): Add numeric elapsed time field elapsed_secs #3004
Conversation
b9893de
to
bb12f58
Compare
bb12f58
to
96a6ee7
Compare
715e4a1
to
ae47d0d
Compare
Thanks @iamjpotts for considering my use-case! I will just chime in and say I like this change! Maybe consider using |
I'd say just go with nanoseconds for maximum precision, or seconds/subsecond nanos, or seconds as |
@Matthias247 will floating point |
Sure it will work too. The visitor would then look something like fn record_f64(&mut self, field: &field::Field, value: f64) {
match field.name() {
"elapsed_secs" => {
self.elapsed = std::time::Duration::from_secs_f64(value);
}
}
}
} It might be a tiny bit less efficient than parsing an integer number. But compared to the overall complexity of a SQL query it doesn't matter a lot. |
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
ae47d0d
to
615bd4d
Compare
Now with |
…unchbadge#3004) Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
This is a partial resolution to #2671.
I chose
elapsed_ms
overelapsed_us
as sub-millisecond latencies are not likely interesting for a relational database query, and individuals searching and filtering logs would find milliseconds more convenient.I also left the existing
elapsed
string field in place in case it is being used by others in ops and monitoring (which seems to be the case with @Matthias247).