You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When tags are configured via the micronaut.metrics.tags property, the MeterFilter that applies those tags should be registered with the MeterRegistry before any Meters.
Actual Behaviour
When tags are configured via the micronaut.metrics.tags property, the MeterFilter that applies those tags is sometimes (but not always) registered after other metrics managed by the framework (e.g. jvm.buffer.memory.used).
About 50% of the time, the following warning will appear in the logs:
A MeterFilter is being configured after a Meter has been registered to this registry. All MeterFilters should be configured before any Meters are registered. If that is not possible or you have a use case where it should be allowed, let the Micrometer maintainers know at micrometer-metrics/micrometer#4920. Enable DEBUG level logging on this logger to see a stack trace of the call configuring this MeterFilter.
Environment Information
Java 21, multiple architectures.
Example Application
No response
Version
4.7.1
The text was updated successfully, but these errors were encountered:
I wrote a minimal reproduction for this issue, but I hesitate to propose actually including it as a unit test because it contains no assertions. Still, for your convenience:
packageio.micronaut.configuration.metrics;
importio.micrometer.core.instrument.MeterRegistry;
importio.micronaut.context.annotation.Property;
importio.micronaut.test.extensions.junit5.annotation.MicronautTest;
importjakarta.inject.Inject;
importorg.junit.jupiter.api.Test;
@MicronautTest@Property(name = "micronaut.metrics.enabled", value = "true")
@Property(name = "micronaut.metrics.binders.jvm.enabled", value = "true")
@Property(name = "micronaut.metrics.tags.test", value = "test")
publicclassMeterFilterRaceConditionTest {
@SuppressWarnings("unused")
@InjectMeterRegistrymeterRegistry;
@TestvoidtestRegistrationRace() {
// There isn't really anything to assert, but about 50% of the time, we'll get warnings// about MeterFilters being registered after a Meter.
}
}
Expected Behavior
When tags are configured via the
micronaut.metrics.tags
property, theMeterFilter
that applies those tags should be registered with theMeterRegistry
before anyMeters
.Actual Behaviour
When tags are configured via the
micronaut.metrics.tags
property, theMeterFilter
that applies those tags is sometimes (but not always) registered after other metrics managed by the framework (e.g.jvm.buffer.memory.used
).Steps To Reproduce
application.yml
:About 50% of the time, the following warning will appear in the logs:
Environment Information
Java 21, multiple architectures.
Example Application
No response
Version
4.7.1
The text was updated successfully, but these errors were encountered: