Our system consists of multiple JAVA based microservices, each one reports its RT status leveraging io.prometheus simpleclient
The integration code looks pretty straightforward
// Initialize default JVM metrics for Prometheus
DefaultExports.initialize();
DeploymentInfo monitoringServletInfo = Servlets.deployment()
.setClassLoader(MonitoringServer.class.getClassLoader())
.setContextPath("/")
.setDeploymentName("monitoring")
.addServlet(Servlets.servlet(MetricsServlet.class).addMapping("/*"));
DeploymentManager monitoringDeployment = Servlets.defaultContainer().addDeployment(monitoringServletInfo);
monitoringDeployment.deploy();
HttpHandler monitoringHandler = monitoringDeployment.start();
server = Undertow.builder()
.addHttpListener(port, "0.0.0.0")
.setHandler(
Handlers.path().addExactPath(HEALTH_PATH, new HealthHandler())
.addExactPath(MONITORING_PATH, monitoringHandler))
.build();
server.start();
Since all microservices expose the same metrics name we are looking for a way to distinguish them by providing a custom label for each microservice
for example, this metrics has the following definition
jvm_buffer_pool_used_bytes{pool="direct",} 116776.0
our purpose is to add a custom label like, then it will be super easy to separate than in the Grafana.
jvm_buffer_pool_used_bytes{pool="direct",service="foo"} 116776.0
I want to believe the lib has to have such capability, unfortunately googling it for a while was not such successful
Any idea will be appreciated.