0
votes

I have a number of applications that are using the SpringBoot actuator to publish metrics to the /metrics endpoint.

I have some other applications that are also using Micrometer to publish metrics to a /prometheus endpoint.

And finally, I have a cloud provider that will only allow me to pull metrics from a single end point. They have many preprepared Grafana dashboards, but most are targeted at the Actuator variable names. Some are targeted at the Micrometer variable names.

Micrometer puts out the same data, but it uses different names than Actuator, eg "jvm_memory" instead of "mem".

I would really like to find a way to merge both of these data sources so that they dump data to a single endpoint, and all of my Grafana dashboards would just work with all of the applications.

But I'm at a loss as to the best way to do this. Is there a way to tell Micrometer to use /metrics as a datasource so that any time it is polled it will include those?

Any thoughts are greatly appreciated.

2
What version of SpringBoot are you using? The metrics actuator is powered by the Micrometer metrics in Boot 2, however with Boot 1, they differed in architecture so that is probably why you are seeing differences.checketts
I'm using 1.5.13Joe Zitzelberger

2 Answers

0
votes

The best solution probably depends on the complexity of your dashboard. You might just configure a set of gauges to report the value under a different name and then only use the Micrometer scrape endpoint. For example:

@Bean
public MeterBinder mapToOldNames() {
    return r -> {
        r.gauge("mem", Tags.empty(), r, r2 -> r2.find("jvm.memory.used").gauges()
                .stream().mapToDouble(Gauge::value).sum());
    };
}

Notice how in this case we are converting a memory gauge that is dimensioned in Micrometer (against the different aspects of heap/non-heap memory) and rolling them up into one gauge to match the old way.

0
votes

For Spring Boot 1.5 you could do something like the Prometheus `simpleclient_spring_boot' does.

You collect the PublicMetrics from the actuator-metrics context and expose/register them as Gauges/Counters in the Micrometer MeterRegistry. This in term will expose those actuator metrics under your Prometheus scrape endpoint.

I assume you'd filter out non-functional metrics which are duplicates of the Micrometer ones. So the only thing I can think of is functional/business metrics to actually take over. But if you have the chance to actually change the code to Micrometer, I'd say that's the better approach.

I haven't tried this, just remembered I had seen this concept.