-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
prometheus receiver handling of lone _created metrics #30309
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Thanks for the report. I'll look into it when I have time. |
So I took a look at this, and found the cause here: opentelemetry-collector-contrib/receiver/prometheusreceiver/internal/metricfamily.go Line 300 in 788f03e
if metrics has the
but I am not sure if that's the best approach. |
I think we would need to ensure that the suffix is in addition to the normal metric name (that we looked up in the metadata cache). |
Openmetrics spec demonstrating created timestamp: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#overall-structure Discussed this at the SIG meeting. If the metricfamily name + |
Description: As discussed in the OTEL Prometheus working group, to fix this case we check If the metricfamily (which we get from the metadata) name + _created == the series name match. Then we treat it as created timestamp. Link to tracking Issue: #30309 Testing: Reproduced based on the details provided in the issue, added a test case covering the case. Documentation: --------- Co-authored-by: David Ashpole <[email protected]>
) Description: As discussed in the OTEL Prometheus working group, to fix this case we check If the metricfamily (which we get from the metadata) name + _created == the series name match. Then we treat it as created timestamp. Link to tracking Issue: open-telemetry#30309 Testing: Reproduced based on the details provided in the issue, added a test case covering the case. Documentation: --------- Co-authored-by: David Ashpole <[email protected]>
Component(s)
receiver/prometheus
What happened?
Description
Metrics from a prometheus (but not openmetrics) client library ending with
_created
don't have their values set.Steps to Reproduce
Run go program:
Run collector (see below for config)
Expected Result
A metric with name
my_thing_created
and value 300.Actual Result
a metric with name
my_thing_created
and value 0, with a wrong start timestamp.Collector version
otelcol-contrib version 0.91.0
Environment information
OpenTelemetry Collector configuration
Log output
Additional context
The metric looks like this in the scrape output:
OpenMetrics uses
_created
as one of the special suffixes for defining the start timestamp of a given time series: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#suffixesgiven the TYPE hint, the metric shouldn't be treated as a timestamp, since it's an exact match, not with an extra
_created
suffix appended.It looks like the collector is treating the metric as a timestamp (300s == 5 min past unix epoch), but also for the wrong metric name, since it it were a timestamp, it should be for a metric named
my_metric
instead ofmy_metric_created
The text was updated successfully, but these errors were encountered: