opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

[prometheusreceiver] Fix metrics being grouped into the same metrics family incorrectly

Open newly12 opened this issue 3 years ago • 2 comments

Description: <Describe what has changed.> Fix metrics being grouped into the same metrics family incorrectly

Link to tracking Issue: <Issue number if applicable> Fixes #13117

Testing: <Describe what testing was performed and which tests were added.> UT

Documentation: <Describe the documentation added.> n/a

newly12 avatar Aug 11 '22 05:08 newly12

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Aug 27 '22 05:08 github-actions[bot]

@Aneurysm9 could you please comment?

newly12 avatar Aug 29 '22 09:08 newly12

@dashpole please do a final review and add the ready to merge label after.

bogdandrutu avatar Sep 29 '22 06:09 bogdandrutu

I think we should wait on this. I was able to discuss this at the prom wg yesterday (notes), and we concluded that we should see if it is possible for the appender to know if the metrics came from OpenMetrics or from Prometheus

dashpole avatar Sep 29 '22 14:09 dashpole

Thanks @dashpole , do we have any prometheus issue being tracked for this currently?

newly12 avatar Oct 13 '22 09:10 newly12

While writing up the issue, i've realized that knowing openmetrics vs prometheus won't help us. I was going to write:

The OpenTelemetry collector's prometheus receiver is implemented as an Appender. One issue we currently have is that we don't know how to correctly associate metric points with type (or other) comments. For example, with the Prometheus metrics:

# TYPE foo gauge
foo{} 1
# TYPE foo_total counter
foo_total{} 1

Each metric point should be associated with the metric family of the same name (foo with foo, foo_total with foo_total)

However, with the OpenMetrics metrics:

# TYPE foo counter
foo_total{} 1
# TYPE foo_total gauge
foo_total{} 1

We want to associate the metrics with the counter, rather than the gauge.

But then I read in the OpenMetrics spec:

The name of a MetricFamily MUST NOT result in a potential clash for sample metric names as per the ABNF with another MetricFamily in the Text Format within a MetricSet. An example would be a gauge called "foo_created" as a counter called "foo" could create a "foo_created" in the text format.

So the OpenMetrics example above is invalid. In that case, I think it is correct for us to accept this PR.

dashpole avatar Oct 13 '22 14:10 dashpole

@codeboten @Aneurysm9 could you please review this PR?

newly12 avatar Oct 17 '22 05:10 newly12