prometheus / client_golang

Prometheus instrumentation library for Go applications
https://pkg.go.dev/github.com/prometheus/client_golang
Apache License 2.0
5.4k stars 1.18k forks source link

Timestamp in metrics not supported #315

Closed br-privacore closed 7 years ago

br-privacore commented 7 years ago

We scrape metrics from servers every minute using the https://github.com/tgulacsi/prometheus_scollector/ "proxy", in order to use scollector plugins.

The collected data contains number of events the last minute (reset every minute).

I worry about the timing of things here: 1) scollector script runs every 55 seconds to collect data and send to prometheus_scollector proxy. 2) prometheus_scollector proxy holds the data for a minute 3) Prometheus scrapes every minute to collect that data.

scollector script could be a bit delayed because of high resource usage, and Prometheus could read the same sample twice.

It seems like the timestamp used in the scollector sample data is thrown away by the prometheus_scollector proxy and therefore not scraped by Prometheus. It would expect it to have been used for sample deduplication.

Is there a way to handle sample deduplication by passing on a "unique key" to Prometheus?

Brian Brazil on the prometheus-users mailing list: The way to do that is via the timestamp. That's not supported by any client library yet though, including the Go client which prometheus_scollector uses.

beorn7 commented 7 years ago

Yes, this is #187 .

Marking this as dupe.