micrometer icon indicating copy to clipboard operation
micrometer copied to clipboard

Avoid creating redundant NoopMeters

Open lenin-jaganathan opened this issue 1 year ago • 9 comments

Please describe the feature request. Currently, when the register method is called it invokes the registerMeterIfNecessary and then getOrCreateMeter. getOrCreateMeter applies the meter-filters and if any of the filters reply with a MeterFilterReply.DENY then a NoopMeter is created and returned. For every MeterFilterReply.DENY we go on creating a new NoopMeter which seems unnecessary. Instead, we should have DefaultInstances created for each of the NoopMeter and the same instance should be returned.

Rationale NoopMeter as the name suggests no-op and does nothing. So returning a default instance should be fine.

lenin-jaganathan avatar Feb 01 '24 06:02 lenin-jaganathan