Skip to content
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

fix(prometheus): handle metrics with same name but varying tags. #4

Merged
merged 7 commits into from
Jun 29, 2020

Conversation

fieldju
Copy link
Contributor

@fieldju fieldju commented Jun 29, 2020

The functional test and integration tests attached to this PR proves that micrometer-metrics/micrometer#877 (comment) is no longer true.

I have temporarily copy and pasted the registry PrometheusMeterRegistry class:

I have modified the following the offending method to not throw and error and registry a new entry instead:

private MicrometerCollector collectorByName(Meter.Id id) {
return collectorMap.compute(
getConventionName(id),
(name, existingCollector) -> {
List<String> tagKeys = getConventionTags(id).stream().map(Tag::getKey).collect(toList());
if (existingCollector != null && existingCollector.getTagKeys().equals(tagKeys)) {
return existingCollector;
}
return new MicrometerCollector(id, config().namingConvention(), prometheusConfig)
.register(registry);
});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants