I want to disable all builtin metrics (jvm, cpu, etc) but keep my custom metrics.
When I enabled Spring Boot Actuator metrics together with Datadog I end up with +320 metrics sent to datadog. Most of these metrics are from the builtin core metrics (JVM metrics, CPU metrics, File description metrics) only 5 of those metrics are my custom metrics that are the ones that I want to send to datadog.
According to this section of the Spring Boot documentation:
Spring Boot also configures built-in instrumentation (i.e. MeterBinder implementations) that you can control via configuration or dedicated annotation markers
but there is no direct example on how to exclude the those metrics
From what I found in this other SO question one way to control it is:
management.metrics.enable.all=false
management.metrics.enable.jvm=true
and that removes all the metrics except the JVM ones. But it also removes my custom metrics.
I don't see how can I reenable my custom metrics.
Just for the record the way I register the custom metrics is this way:
@Autowired
public void setMeterRegistry(MeterRegistry registry) {
this.meterRegistry = registry;
}
....
Counter n_event_in = this.meterRegistry.counter("n_events_in");
This works ok, as long as `management.metrics.enable.all=true
So how can I disable all core metrics , but keep my custom metrics?
text cannot be parsed to duration
inspite of giving proper seconds value in step. Or with another way, I get datadog missing exception. – esha ingle