You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the current implementation of stackdriver_exporter doesn't add timestamp on metrics. if a timestamp is not added to metrics, Prometheus adds the scrape timestamp on the metrics scraped from /metrics endpoint on stackdriver_exporter. This implementation doesn't allow us to show the Stackdriver data collection lag on the metrics(which we are storing on Prometheus) as Prometheus is adding the timestamp of scrape time.
prometheus/client_golang has feature released on v0.9 version, which allows users to add timestamp on the metrics.
We can use NewMetricWithTimestamp, which is a wrapper on top of existing metrics type which prometheus_client library provides.
prometheus.NewMetricWithTimestamp(
reportTime, // Get the timestamp from stackdriver metrics data
prometheus.MustNewConstHistogram(
t.newMetricDesc(fqName, labelKeys),
uint64(dist.Count),
dist.Mean*float64(dist.Count),fake it
buckets,
labelValues...,
),
)
The text was updated successfully, but these errors were encountered:
One word of warning when using timestamps on exported metrics, you can easily run into staleness problems which will create gaps in Prometheus. Or if the timestamp is too far off, Prometheus will drop the data entirely.
the current implementation of stackdriver_exporter doesn't add timestamp on metrics. if a timestamp is not added to metrics, Prometheus adds the scrape timestamp on the metrics scraped from /metrics endpoint on stackdriver_exporter. This implementation doesn't allow us to show the Stackdriver data collection lag on the metrics(which we are storing on Prometheus) as Prometheus is adding the timestamp of scrape time.
prometheus/client_golang has feature released on v0.9 version, which allows users to add timestamp on the metrics.
We can use NewMetricWithTimestamp, which is a wrapper on top of existing metrics type which prometheus_client library provides.
The text was updated successfully, but these errors were encountered: