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

Remove unnecessary call to getConventionName in PrometheusMeterRegistry #4607

Closed
davidmestr opened this issue Jan 22, 2024 · 0 comments
Closed
Labels
enhancement A general enhancement performance Issues related to general performance registry: prometheus A Prometheus Registry related issue
Milestone

Comments

@davidmestr
Copy link
Contributor

davidmestr commented Jan 22, 2024

We need some customization in the collector name, but in PrometheusMeterRegistry and MicrometerCollector, the collector name is calculated two times (and the second is difficult to customize):

  • In PrometheusMeterRegistry (applyToCollector method) the collector name is retrieved from getConventionName(Meter.Id id) method, in order to be used as a key in the internal collectionMap.
  • But, when the MicrometerCollector is created, the collector name is calculated another time in the MicrometerCollector constructor.

We propose to unify the collector name passing the first calculated name (in PrometheusMeterRegistry.getConventionName(id)) to MicrometerCollector constructor.

With this easy change, it is posible to uncouple the metric name to the collector name, and resolve some existent issues related to some Prometheus metric name restrictions that doesn't exist in Micrometer.

We also provide a PR with the small changes in the PrometheusMeterRegsitry.applyToCollector and MicrometerCollector classes.

@shakuzen shakuzen added enhancement A general enhancement registry: prometheus A Prometheus Registry related issue performance Issues related to general performance and removed waiting-for-triage labels Jan 30, 2024
@shakuzen shakuzen added this to the 1.13.0-M1 milestone Jan 30, 2024
@shakuzen shakuzen changed the title Unify the collector name in PrometheusMeterRegistry and MicrometerCollector Remove unnecessary call to getConventionName in PrometheusMeterRegistry Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement performance Issues related to general performance registry: prometheus A Prometheus Registry related issue
Projects
None yet
Development

No branches or pull requests

2 participants