prometheus / client_java

Prometheus instrumentation library for JVM applications
http://prometheus.github.io/client_java/
Apache License 2.0
2.17k stars 792 forks source link

[FeatureRequest] Add option to distinguish JVM metrics from multiple sources #986

Open penev-ff opened 8 hours ago

penev-ff commented 8 hours ago

Hello,

The JVM instrumentation module provides a variety of out-of-the-box JVM and process metrics. This is very useful for monitoring the JVM characteristics. I know that you can also register particular JVM metrics separately.

However, I would like to propose a feature that allows renaming the JVM metrics exposed by the JvmMetrics class, or at least an option to add a prefix/domain to the metrics name.

i.e. jvm_threads_current -> com_org_jvm_threads_current

This would be very useful for users who want to distinguish between the JVM metrics coming from multiple sources.

dhoard commented 8 hours ago

@penev-ff can you elaborate/provide a more concrete use case this solves?

penev-ff commented 6 hours ago

@dhoard

A Kubernetes cluster with multiple Java-based microservices running in separate pods. Each pod hosts a Java process, and you are using a monitoring solution like Dynatrace to collect JVM metrics from all these processes. Dynatrace scrapes these metrics from endpoints exposed by the Java processes running inside the pods.

When identical metric names are used across different pods, it becomes challenging to distinguish which metrics belong to which pod or microservice in Dynatrace.