Synchronous gauges should get exposed at ongoing current timestamps, not the timestamp of the last Record() call #5510
Labels
area:metrics
Part of OpenTelemetry Metrics
bug
Something isn't working
pkg:SDK
Related to an SDK package
Milestone
Chatted about this with @gouthamve and he said @dashpole recommend filing an issue:
Description
When I create a synchronous gauge and call
Record(1)
on it once, the gauge gets exposed repeatedly (over time) at the timestamp of the initialRecord()
call. My expectation was that the gauge would be exposed with ongoing (current) timestamps whenever metrics are pushed/read. From what I can gather from the metrics SDK spec, my expectation is also how it should behave:The current behavior breaks any usage of synchronous gauges with Prometheus where you don't set the value regularly, because the data point being ingested at always the same timestamp initially just leads to a 1-point (non-continuous) time series being ingested, and then after a while just
msg="Out of order sample from remote write" err="out of bounds"
style errors from Prometheus as OTel tries to send data points that are too old for Prometheus to ingest.Steps To Reproduce
To see the whole issue, including Prometheus raising errors about out-of-bounds samples, run a Prometheus server with OTLP ingestion enabled:
And then run the following OTel example to ingest gauge samples into it (and also pretty-print-log them to stdout):
The text was updated successfully, but these errors were encountered: