- spring-boot-starter-parent:2.6.5
- micrometer-registry-prometheus: 1.8.4
- spring-boot-starter-actuator:2.6.5
- even when setting
@Bean
MeterRegistryCustomizer<PrometheusMeterRegistry> metricsCommonTags() {
return registry -> registry.config()
.namingConvention(NamingConvention.snakeCase)
.commonTags("env", config.getMode().name());
}
- conf:
management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true
- metrics
# TYPE application_ready_time gauge
application_ready_time{env="DEVELOPMENT",main-application-class="si.app.myApplication",} 2.489
# TYPE application_started_time gauge
application_started_time{env="DEVELOPMENT",main-application-class="si.app.myApplication",} 2.445
- Prometheus parser fail for label(tag) main-application-class it should be main_application_class
Comment From: sysmat
in version spring-boot-starter-parent:2.6.4 it use micrometer-registry-prometheus:1.8.3 and snake case it works
# HELP application_started_time_seconds Time taken (ms) to start the application
# TYPE application_started_time_seconds gauge
application_started_time_seconds{env="DEVELOPMENT",main_application_class="si.my.myApplication",} 12.755
- bug is 2.6.5 with actuator:2.6.5 and micrometer-registry-prometheus:1.8.4
Comment From: sysmat
- 2.6.4 works snake_case
@Bean
MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
return registry -> registry.config()
.commonTags("env", config.getMode().name());
}
Comment From: sysmat
- spring-boot-starter-parent:2.6.5 and micrometer-registry-prometheus:1.8.3 snake case for label works(main_application_class)
Comment From: mbhave
@sysmat If there's a bug, it appears to be in the Micrometer project, especially because downgrading the micrometer-registry-prometheus version fixed the issue for you. Since you've already created an issue there, can you continue the discussion there? If it turns out to be something in Spring Boot, we can reopen this issue.
Comment From: sysmat
they closed it: https://github.com/micrometer-metrics/micrometer/issues/3108
Comment From: sysmat
it is very bad in production because not valid Prometheus label Prometheus scraper will not save any metric in DB
Comment From: snicoll
@sysmat every comment you write is sending an email to 3K people. As Madhura indicated, please follow-up on the Micrometer issue you've already raised. I had a quick look to it and they don't seem to understand what you're trying to do. One way to move forward there is to share with them a small sample that reproduces what you've described.