Skip to content

Avoid creating redundant NoopMeters #4634

@lenin-jaganathan

Description

@lenin-jaganathan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementA general enhancementmodule: micrometer-coreAn issue that is related to our core moduleperformanceIssues related to general performance

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions