-
Notifications
You must be signed in to change notification settings - Fork 188
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
Metrics::set_timestamp_ms incorrectly implies milliseconds should be used #425
Comments
Thanks for the report. It would be good if you could link some references for your statements. According to https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information, that field is:
|
Hi, sorry for that. The relevant link is here. We needed the timestamps at work in order to support backfilling metrics into prometheus, so I can confirm firsthand that using promtool's I may be wrong in approaching this only from the exporting and then backfilling perspective, but in either case I think that just naming it |
Oh well, it is sad that OpenMetrics has a different timestamp format, but in the end it's an explicitly new/separate standard so they are free to diverge however they prefer. Additionally, it seems that the Prometheus field is a signed integer, while the OpenMetrics one is a float with nanoseconds precision. |
For this crate, the the correct reference would be the one below, given that it implements the old Prometheus output format and not the new OpenMetrics output format. https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information
In case using the old Prometheus format is fine for you @Mikadore, you can continue using |
I split some further |
Got some further feedback on the upstream discussion. The summary is:
Thus both this library current behavior and |
Metric::set_timestamp_ms
is incorrectly named_ms
, even though both prometheus and the Openmetrics standard expect this to be in seconds. Furthermore, since the code just stores the number as ani64
, the semantics of the function don't care about units.Metric::set_timestamp_ms
should be either renamed toMetric::set_timestamp_s
or just purelyMetric::set_timestamp
. In any case, it should be documented that both prometheus and openmetrics require seconds.The text was updated successfully, but these errors were encountered: