-
Notifications
You must be signed in to change notification settings - Fork 845
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
Solve the duplicate metrics definition issue in Micrometer shim #4457
Solve the duplicate metrics definition issue in Micrometer shim #4457
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4457 +/- ##
=========================================
Coverage 90.02% 90.03%
- Complexity 4970 4972 +2
=========================================
Files 570 570
Lines 15384 15387 +3
Branches 1472 1472
=========================================
+ Hits 13850 13853 +3
Misses 1064 1064
Partials 470 470
Continue to review full report at Codecov.
|
|
||
final class Bridging { | ||
|
||
private static final ConcurrentMap<String, String> descriptionsCache = new ConcurrentHashMap<>(); |
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.
I have a tiny worry that someone will be creating dynamically named meters and making this grow without bound, but I think that's a small worry that probably means they're doing sometime wrong with micrometer.
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.
If someone does that other areas of the metrics SDK will cause memory pressure at a faster pace than this.
|
||
final class Bridging { | ||
|
||
private static final ConcurrentMap<String, String> descriptionsCache = new ConcurrentHashMap<>(); |
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.
If someone does that other areas of the metrics SDK will cause memory pressure at a faster pace than this.
@jack-berg @jkwatson @mateuszrzeszutek |
IMO this doesn't meet the criteria for a patch release since its not a regression, memory leak or deadlock. The change improves the ergonomics of bridging micrometer into opentelemetry, but nothing is specifically broken at the moment. |
Resolves #4381
I added a descriptions cache, only the first description seen will be used, the rest will just get ignored (pretty much the same behavior as
PrometheusMeterRegistry
). I tried to use theMeterFilter
for that at first, but it turned outMeter.Id
does not have any method for overriding the description.