A created a simple micronaut application that exposes micrometer metrics. I want to add custom tags, but the bean that does that is not loaded at startup.
What am i missing? Remark: It does not so on local pc when started with intellj. But it does work when deployed on k8s.
Bean:
@Factory
open class MeterFilterFactory {
@Bean
@Singleton
fun addCommonTags(): MeterFilter {
return MeterFilter.commonTags(
Arrays.asList(
Tag.of("service", "my-super-service"),
Tag.of("special", "tag comes here")
)
)
}
}
application config
micronaut:
metrics:
enabled: true
sensitive: true
export:
prometheus:
enabled: true
step: PT1M
descriptions: true
distribution:
percentiles-histogram:
http.server.requests: true
sla:
http.server.requests: 1ms,5ms
binders:
logback:
enabled: false
processor:
enabled: false
uptime:
enabled: false
build gradle
compile "io.micronaut.configuration:micronaut-micrometer-registry-statsd"
compile "io.micronaut:micronaut-management"
compile "io.micronaut.configuration:micronaut-micrometer-registry-prometheus"
Currently i get back
{"name":"system.cpu.usage","measurements":[{"statistic":"VALUE","value":0.07751937984496124}]}
but i miss the tags that i tried to add.
IntelliJ cache clearing + restart solved the issue.