Skip to content
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

Allow specifying timestamps for metrics #17

Closed
j2ghz opened this issue Jun 7, 2020 · 1 comment · Fixed by #18
Closed

Allow specifying timestamps for metrics #17

j2ghz opened this issue Jun 7, 2020 · 1 comment · Fixed by #18
Labels
enhancement New feature or request

Comments

@j2ghz
Copy link
Contributor

j2ghz commented Jun 7, 2020

The prometheus format specification has an optional timestamp after the value, but it's not possible to specify it with PrometheusMetric's render_sample currently. I was going to open a PR adding an Option<> parameter for it, but that'd be a breaking change. Is that fine, or should I make it as another function (e.g. render_sample_timestamp)?

metric_name [
  "{" label_name "=" `"` label_value `"` { "," label_name "=" `"` label_value `"` } [ "," ] "}"
] value [ timestamp ]

The timestamp is an int64 (milliseconds since epoch, i.e. 1970-01-01 00:00:00 UTC, excluding leap seconds), represented as required by Go's ParseInt() function.
https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-details

@MindFlavor MindFlavor added the enhancement New feature or request label Jun 13, 2020
@MindFlavor
Copy link
Owner

I think a single function is better even if it will mean introducing a breaking change: the API should be as similar as possible to the specification (within reason OC)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants