Closed eloo closed 7 years ago
I think you should set up the common tags in Prometheus instead when you scrape it. That is how it is intended. The metrics that are missing the common tags are coming from the Prometheus direct instrumentation.
I think this feature is more intended for the push model backends
It's certainly a bug, or a lazy implementation on my part. The way it is right now, common tags are applied to every metric created after the common tag is appended to the registry. In this case, some of the binders were added before you get a chance to add common tags. This should certainly be improved.
Atlas also has a proprietary property-based common tag config (so it isn't really a push vs. pull thing), but I'd like for folks to at least have the option for their common tags to be portable across monitoring systems. Of course, if you prefer the server-side config, that is perfectly fine!
Thanks again @Eloo for the write-up.
I'll update the docs before the 0.8.0 release is published, but the short of it is common tags should be applied like so:
@Bean
public MeterRegistryConfigurer configurer() {
return registry -> registry.commonTags("region", "us-east-1");
}
Any such beans are guaranteed to be applied before any meters are registered.
thanks @jkschneider for fixing this. looking forward to test the next release ;)
yep works for the micrometer metrics but seems not to work on springboot actuator metrics is this intended?
Haven't yet bridged legacy Spring Boot actuator metrics to the dimensional system (this would involve a hierarchical -> dimensional mapping in addition to 0.8.0's new support for dimensional -> hierarchical). My current thought is that there should be an equivalent MeterBinder
in micrometer for everything that is currently in actuator metrics so that there should not need to be a bridge.
Thanks jkschneider.
Here is my sample how to inject "app" as common tags to all metrics.
@Component public class MicroMeterConfig implements MeterRegistryCustomizer {
@Autowired
ConfigurableApplicationContext appContext;
@Override
public void customize(MeterRegistry registry) {
registry.config().commonTags("app", appContext.getEnvironment().getProperty("info.app.name"));
}
}
How can i configure the common tags in Micronaut Framework. I'm kinda stuck
How can i configure the common tags in Micronaut Framework. I'm kinda stuck
That's a question for the Micronaut community. I would consult their Micronaut Micrometer documentation: https://micronaut-projects.github.io/micronaut-micrometer/latest/guide/index.html. Searching for "commonTags" you can see they show how to do it with either a MeterRegistryConfigurer
or a MeterFilter
.
In case someone needs common tags for Micronaut, here is an example at how i did it:
` @Singleton public class MeterRegistryConfig implements MeterRegistryConfigurer {
@Override
public void configure(MeterRegistry meterRegistry) {
meterRegistry.config().commonTags("your_custom_key", "your_custom_value");
}
@Override
public boolean supports(MeterRegistry meterRegistry) {
return true;
}
} `
Just tested the 0.7.0 Release and its new common tags. But it seems that not all metrics are populated with these tags.
Tags were set like this
Thanks