-
Notifications
You must be signed in to change notification settings - Fork 834
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
PrometheusHttpServer drops metrics with same name and different type #5078
Conversation
@@ -47,7 +47,7 @@ class SerializerTest { | |||
.setVersion("version") | |||
.setAttributes(Attributes.of(stringKey("ks"), "vs")) | |||
.build(), | |||
"instrument.name", | |||
"monotonic.cumulative.double.sum", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the metrics in this test used the same name, which produce name collisions with the new rules. I've changed the metric names to be a dot.delimited.version of the names of the fields they're assigned to.
Map<String, List<MetricData>> metricsByName = new LinkedHashMap<>(); | ||
Set<InstrumentationScopeInfo> scopes = new LinkedHashSet<>(); | ||
// Iterate through metrics, filtering and grouping by headerName | ||
for (MetricData metric : metrics) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A for loop is more appropriate because we now need to track the unique scopes we've seen and metric name conflicts, which we return to the caller for logging purposes.
Codecov ReportBase: 91.06% // Head: 91.06% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #5078 +/- ##
=========================================
Coverage 91.06% 91.06%
+ Complexity 4888 4887 -1
=========================================
Files 553 553
Lines 14453 14465 +12
Branches 1381 1387 +6
=========================================
+ Hits 13161 13173 +12
Misses 895 895
Partials 397 397
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
LOGGER.log( | ||
Level.WARNING, | ||
"Metric conflict(s) detected. Multiple metrics with same name but different type: " | ||
+ conflictHeaderNames.stream().collect(joining(",", "[", "]"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goal is to log each name conflict that is detected once to avoid spammy logs.
Resolves #5014.