- 
                Notifications
    
You must be signed in to change notification settings  - Fork 168
 
Description
Component(s)
jmx-scraper
Is your feature request related to a problem? Please describe.
JMX Scraper role is to collect metrics from a remote JVM, so the resource attributes of the captured metrics should reflect the remote JVM identity. For example, the service.name should be set on the JMX Scraper JVM to reflect the name of the observed remote JVM service.
Currently, a random service.instance.id (semconv) is randomly generated by the SDK, which means that a distinct value of service.instance.id is used for every JMX Scraper process, even if the target JVM process remains the same.
As a result, whenever the JMX Scraper is restarted (for example to update its configuration), it will report metrics that appear to come from distinct service instances when the target JVM hasn't been restarted and there is a single instance, hence creating potentially confusing metrics.
Describe the solution you'd like
In order to solve this, I would suggest to use a stable UUID value that depends only on the target JVM state, for example by querying the following MBean attributes values before the metrics are collected:
java.lang:type=Runtime>StartTimeattribute (API)java.lang:type=Runtime>Pidattribute (API)java.lang:type=Runtime>Nameattribute (API) which combines PID + hostname (at least on hotspot).
Describe alternatives you've considered
No response
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.