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

Solve the duplicate metrics definition issue in Micrometer shim #4457

Merged

Conversation

mateuszrzeszutek
Copy link
Member

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 the MeterFilter for that at first, but it turned out Meter.Id does not have any method for overriding the description.

@codecov
Copy link

codecov bot commented May 10, 2022

Codecov Report

Merging #4457 (91fb7ae) into main (6606020) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            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           
Impacted Files Coverage Δ
...ava/io/opentelemetry/micrometer1shim/Bridging.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6606020...91fb7ae. Read the comment docs.


final class Bridging {

private static final ConcurrentMap<String, String> descriptionsCache = new ConcurrentHashMap<>();
Copy link
Contributor

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.

Copy link
Member

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<>();
Copy link
Member

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 jack-berg merged commit a9968bc into open-telemetry:main May 10, 2022
@pkgonan
Copy link

pkgonan commented May 11, 2022

@jack-berg @jkwatson @mateuszrzeszutek
Hi.
I think this Bug Fix will be released in 1.14.1. When is the 1.14.1 release planned?

@jack-berg
Copy link
Member

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.

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.

Lots of duplicate metric definitions for micrometer shim
4 participants