Remove unnecessary call to getConventionName in PrometheusMeterRegistry #4607
Labels
enhancement
A general enhancement
performance
Issues related to general performance
registry: prometheus
A Prometheus Registry related issue
Milestone
We need some customization in the collector name, but in
PrometheusMeterRegistry
andMicrometerCollector
, the collector name is calculated two times (and the second is difficult to customize):PrometheusMeterRegistry
(applyToCollector
method) the collector name is retrieved fromgetConventionName(Meter.Id id)
method, in order to be used as a key in the internalcollectionMap
.MicrometerCollector
is created, the collector name is calculated another time in theMicrometerCollector
constructor.We propose to unify the collector name passing the first calculated name (in
PrometheusMeterRegistry.getConventionName(id)
) toMicrometerCollector
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
andMicrometerCollector
classes.The text was updated successfully, but these errors were encountered: