Closed mjstrasser closed 3 years ago
Hey @KodrAus 👋
Thanks for your help with the Rust! I appreciate you taking the time to help.
I had searched for idiomatic rust option
and similar but didn’t find the ?
operator. It makes the code way cleaner.
Cheers Michael
I had noticed that timestamp sub-second precision was being lost when importing GELF data into Seq. When GELF events with microsecond resolution were imported, events in Seq were truncated or rounded to millisecond resolution.
In
Timestamp::from_float
method the code truncates or rounds to milliseconds. I assume that is to avoid rounding errors from floating-point calculations usingf64
. It is better to use a decimal type that can preserve precision.This proposal is to use the
rust_decimal
type. This type makes it straightforward to extract the whole-number part of the decimal and to adjust the scale of the fractional part so it represents nanoseconds.