Open fedotxxl opened 4 years ago
I was able to add common tag by MeterFilter:
@Bean
@Singleton
MeterFilter addCommonTagFilter() {
return MeterFilter.commonTags(to.list(Tag.of("application", "my-application")));
}
But still:
I have been able to reproduce that not all metrics may have the common tag. However, I've never got an exception. Would you mind sharing a sample app?
This seems to work:
@Singleton
public class CustomMicrometerMeterRegistryConfigurer implements MeterRegistryConfigurer {
@Override
public void configure(MeterRegistry meterRegistry) {
meterRegistry.config().meterFilter(MeterFilter.commonTags(singletonList(Tag.of("scope", "demo"))));
}
@Override
public boolean supports(MeterRegistry meterRegistry) {
return true;
}
}
I was also facing the issue of tags randomly missing and reappearing between container restarts. The reason of this bug is described in #417. They are duplicates.
This also explains why registering a MeterFilter
works reliably while using a MeterRegistryConfigurer
as described in the Micronaut documentation does not.
Hello. I use following modules:
According to this documentation I created MeterRegistryConfigurer to add common tag:
After that metrics behavior becomes pretty unpredictable. After application restart, the following may occur:
Application is run by Intellij IDEA (not grade)
Why application behavior becomes random? Shouldn't it be predictable?