-
Notifications
You must be signed in to change notification settings - Fork 84
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
Timestamp support for const metrics #129
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Lars Strojny <[email protected]>
Signed-off-by: Lars Strojny <[email protected]>
Signed-off-by: Lars Strojny <[email protected]>
@mxinden any thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry for the late review here.
The direction looks good to me. Great job working through the many layers.
Can you add the protobuf implementation. Also would you mind adding a changelog entry?
if let Ok(time) = timestamp.duration_since(UNIX_EPOCH) { | ||
self.writer.write_char(' ')?; | ||
return self.writer.write_str(&time.as_millis().to_string()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we panic in debug mode?
fn write_timestamp(&mut self, timestamp: SystemTime) -> Result<(), std::fmt::Error> { | ||
if let Ok(time) = timestamp.duration_since(UNIX_EPOCH) { | ||
self.writer.write_char(' ')?; | ||
return self.writer.write_str(&time.as_millis().to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library follows the OpenMetrics specification. This should be compatible with recent Prometheus versions (remember to set the right content type).
Please use seconds instead of milliseconds here.
https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#timestamps-1
@mxinden could you have a look if this is roughly what you had in mind?
Addresses #126