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

Custom timestamps? #109

Open
farrerm opened this issue Nov 20, 2021 · 1 comment
Open

Custom timestamps? #109

farrerm opened this issue Nov 20, 2021 · 1 comment

Comments

@farrerm
Copy link

farrerm commented Nov 20, 2021

I'm interested in using custom timestamps, as discussed here:

https://stackoverflow.com/questions/65610580/how-can-we-add-our-own-timestamp-in-prometheus-metric-series

This is supported in prometheus/metric.go, using the function NewMetricWithTimestamp. But, is does not seem to be supported by this repo, i.e. there is no NewMetricWithTimestamp() in sql_exporter/metric.co. Also, the metric definitions are a bit different between these two libraries. So, it is not trivial to call the existing function with an sql_exporter/metric.

I found it was more straightforward to create a similar struct and function in sql_exporter/metric.go.

I haven't tested it yet with Prometheus, but, I'm wondering if it will work? Any tips or advice about using custom timestamps for Prometheus with this library? The change mirrors the existing function. But, my main question is how it will be handled by Prometheus. Kind of a newb, so I'm not really sure even why the metric definitions are so different between the libraries. (yet both appear to work with Prometheus)

And also, after I add the timestamp, how can I display it locally in the localhost:9399/metrics?

@farrerm
Copy link
Author

farrerm commented Nov 30, 2021

In case anyone is wondering, yes, it is possible and Prometheus will read and use the custom timestamps.

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

No branches or pull requests

1 participant