I decided to go the other way. Since the http metrics of spring MVC conflict with Jersey (i.e. the uri is displayed correctly for Jersey, but is duplicated for mvc where uri=“UNKNOWN”), I decided to simply filter them.
Here are the dependencies pom file with dependencies:
<properties>
<java.version>17</java.version>
<camunda.version>7.22.0</camunda.version>
<spring.version>3.3.3</spring.version>
<micrometer.version>1.13.6</micrometer.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>${micrometer.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-micrometer</artifactId>
<version>3.1.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
<version>${camunda.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
</dependencies>
Here is the fitration class:
package org.camunda.bpm.run.plugin.monitoring;
import io.micrometer.core.instrument.config.MeterFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MetricsConfig {
@Bean
public MeterFilter excludeAllExceptEngineRest() {
return MeterFilter.deny(id -> {
if (id.getName().startsWith("http.server.requests")) {
return id.getTags().stream()
.noneMatch(tag -> tag.getKey().equals("uri") && tag.getValue().startsWith("/engine-rest/"));
}
return false;
});
}
}
Yaml settings for metrics:
management:
endpoints:
web:
exposure:
include: prometheus, metrics
metrics:
enable:
jvm: true
hikaricp: true
process: true
logback: false
tomcat: false
system: true
jdbc: false
http: true
distribution:
percentiles-histogram:
http.server.requests: true
percentiles:
http.server.requests: 0.5, 0.9, 0.95, 0.99
I package everything in a jar file and put it as a plugin in the Docker image.
I use prometheus and Grafana for the display.