-
Notifications
You must be signed in to change notification settings - Fork 80
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 <lars@strojny.net>
…menting/exposition_formats/#:~:text=The%20timestamp%20is%20an%20int64 Signed-off-by: Lars Strojny <lars@strojny.net>
Signed-off-by: Lars Strojny <lars@strojny.net>
Signed-off-by: Lars Strojny <lars@strojny.net>
@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.
@mxinden could you have a look if this is roughly what you had in mind?
Addresses #126