Is there a way to turn off some of the returned metric values in Actuator/Micrometer? Looking at them now I'm seeing around 1000 and would like to whittle them down to a select few say 100 to actually be sent to our registry.
Let me elaborate on the answer posted by checketts with a few examples. You can enable/disable certain metrics in your application.yml
like this:
management:
metrics:
enable:
tomcat: true
jvm: false
process: false
hikaricp: false
system: false
jdbc: false
logback: true
Or in code by defining a MeterFilter bean:
@Bean
public MeterFilter meterFilter() {
return new MeterFilter() {
@Override
public MeterFilterReply accept(Meter.Id id) {
if(id.getName().startsWith("tomcat.")) {
return MeterFilterReply.DENY;
}
if(id.getName().startsWith("jvm.")) {
return MeterFilterReply.DENY;
}
if(id.getName().startsWith("process.")) {
return MeterFilterReply.DENY;
}
if(id.getName().startsWith("system.")) {
return MeterFilterReply.DENY;
}
return MeterFilterReply.NEUTRAL;
}
};
}