Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jmx metrics with yaml: need ability to post-process some attribute values #13361

Open
SylvainJuge opened this issue Feb 20, 2025 · 0 comments · May be fixed by #13385
Open

jmx metrics with yaml: need ability to post-process some attribute values #13361

SylvainJuge opened this issue Feb 20, 2025 · 0 comments · May be fixed by #13385
Assignees

Comments

@SylvainJuge
Copy link
Contributor

SylvainJuge commented Feb 20, 2025

JMX Insight is now reused by jmx-scraper in contrib repository, so in theory it would be possible to now capture stable JVM runtime metrics that are part of semconv with declarative YAML from outside of the JVM with jmx scraper.

The current implementation in instrumentation is in instrumentation/runtime-telemetry/runtime-telemetry-java8 does not rely on this declarative YAML metrics capture, even if it relies on the same JMX interface.

When attempting to capture semconv-compliant JVM runtime metrics, we currently can't post-process or normalize the metric attributes, for example with the jvm.memory.{used,committed,limit} metrics, the value of jvm.memory.type comes from an MBean attribute name with values heap and non_heap.

The best we can so so far is to capture those metrics with their original MBean attribute values, the following YAML would capture HEAP and NON_HEAP for jvm.memory.type metric attribute:

rules:

  - bean: java.lang:type=MemoryPool,name=*
    prefix: jvm.memory.
    type: updowncounter
    unit: By
    metricAttribute:
      jvm.memory.pool.name: param(name)
      jvm.memory.type: beanattr(type)
    mapping:
      Usage.used:
        metric: used
        desc: Measure of memory used.
      Usage.committed:
        metric: committed
        desc: Measure of memory committed.
      Usage.max:
        metric: limit
        desc: Measure of max obtainable memory.

In order to solve this, we could introduce a simple lowercase(...) function int he yaml syntax as most of the attributes in semconv are lowercase, for example it could look like this:

  - bean: java.lang:type=MemoryPool,name=*
    prefix: jvm.memory.
    type: updowncounter
    unit: By
    metricAttribute:
      jvm.memory.pool.name: param(name)
      jvm.memory.type: lowercase(beanattr(type))
    mapping:
     # ...

The same logic could be applied to capture jvm.thread.state attribute that has the same issue as the values are provided in upper-case and are lower-cased in semconv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant