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
Describe the bug
Prometheus MetricSnapshots constructor throws because of duplicated metric names. This is a part of the Otel2PrometheusConverter::convert call.
Hard to say really. Metrics of the same type may be merged, but the fact that there are two competing metrics a.b and a_b might indicate a misconfiguration.
What did you see instead?
The Otel2PrometheusConverter::putOrMergemethod uses snapshot.getMetadata().getName() as a unique map key. So metric.name and metric_name are two separate entries.
Prometheus compares sorted snapshot.getMetadata().getPrometheusName()link to find collisions. This means that metric.name and metric_name are both represented as metric_name, and a collision is detected.
What version and what artifacts are you using?
Artifacts: aws-opentelemetry-agent 1.32.1, so opentelemetry 1.32.1 link that targets otel-sdk 1.34.1
Prometheus compares sorted snapshot.getMetadata().getPrometheusName() link to find collisions. This means that metric.name and metric_name are both represented as metric_name, and a collision is detected.
I think this getName vs. getPrometheusName is the key bit here. Its an oversight on our part to use getName for the keys of our map. Opening a PR to adjust it to use getPrometheusName everywhere.
But this won't completely solve the problem. Its still possible that my.metric and my_metric have overlapping series. I.e. both might have a series with attributes {key=a}. If this occurs, then the prometheus client will generate an error. I don't think Otel2PrometheusConverter should be responsible for this merging of series. Instead, if a user encounters this, they should use views to rename one of my.metric or my_metric such that the conflict doesn't occur.
Describe the bug
Prometheus MetricSnapshots constructor throws because of duplicated metric names. This is a part of the
Otel2PrometheusConverter::convert
call.Steps to reproduce
Create two MetricData objects with different
name
s, that resolve to the sameprometheusName
and runconvert
.Testcase to reproduce the error: main...nluk:opentelemetry-java:bug/prometheus-converter-duplicate-metric-name
What did you expect to see?
Hard to say really. Metrics of the same type may be merged, but the fact that there are two competing metrics
a.b
anda_b
might indicate a misconfiguration.What did you see instead?
The
Otel2PrometheusConverter::putOrMerge
method usessnapshot.getMetadata().getName()
as a unique map key. Sometric.name
andmetric_name
are two separate entries.Prometheus compares sorted
snapshot.getMetadata().getPrometheusName()
link to find collisions. This means thatmetric.name
andmetric_name
are both represented asmetric_name
, and a collision is detected.What version and what artifacts are you using?
Artifacts: aws-opentelemetry-agent 1.32.1, so opentelemetry 1.32.1 link that targets otel-sdk 1.34.1
Environment
Compiler: Temurin-17.0.5+8
OS: Ubuntu 22.04
The text was updated successfully, but these errors were encountered: