open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.89k stars 825 forks source link

JMX implementation : feature parity for target systems #12158

Open SylvainJuge opened 1 week ago

SylvainJuge commented 1 week ago

JMX Insights supports some values for otel.jmx.target.system, those are defined in YAML files here.

JMX Gatherer (in contrib) supports more values of otel.jmx.target.system, those are defined in Groovy scripts here.

While the Groovy scripts are convenient, moving to YAML seems a more future-proof solution:

Merging both implementations and bringing them to feature parity means that we have to attempt migrate/align all of the JMX Gatherer supported systems and ensure they can be implemented with YAML. Doing so will highlight any missing feature of the YAML implementation by adding any missing part.

Once the alignment is complete, we should then be able to start on the next step: building a "JMX Scraper" in contrib based on the YAML implementation in instrumentation.

For each system listed below, we need to ensure the following with JMX Insights

List of systems to cover:

SylvainJuge commented 1 week ago

Ping @robsunday I can't yet co-assign you as you are not part of the otel contributors group.

SylvainJuge commented 1 week ago

For Tomcat, the mapping is not the same but almost equivalent, there isn't anything we need to add for 1:1 support beyond aligning the metrics themselves.

Side note: using JMX object names and attributes is a convenient way to identify elements, as it's a common part between the two mappings.

Given the mapping differences, I think here we need we probably need to leave it as-is for now.

robsunday commented 1 week ago

I'll look on Jetty

SylvainJuge commented 1 week ago

For Wildfly, the mapping is also not the same but equivalent, there isn't anything we need to add for 1:1 support beyond aligning the metrics themselves.

SylvainJuge commented 1 week ago

For JVM metrics, the JMX Insight does not provide a YAML file, the feature is implemented in the runtime-metrics module of instrumentation (link). The current definition is aligned with semantic conventions for JVM metrics.

JMX Gatherer provides the following metrics that are not aligned with semconv, all of those can be easily captured with the YAML configuration:

SylvainJuge commented 1 week ago

As a side note, after reviewing differences for jvm, tomcat and wildfly, it becomes more and more obvious to me that there are too many differences to fix. Also, the groovy definitions haven't been modified in 2 or 3 years for some, which means they are very probably obsolete or not really used in practice.

As a consequence, I think the better option for now is to:

The steps that will likely follow are:

robsunday commented 1 week ago

Here are my findings regarding jetty:

SylvainJuge commented 1 week ago

For hbase, there isn't anything in JMX Insight for it, the mappings are simple and it should be quite straightforward (but a bit tedious) to produce an equivalent YAML to hbase.groovy.

SylvainJuge commented 1 week ago

For hadoop:

JMX attribute tag.Hostname is always mapped to node_name metric attribute in both implementations.

JMX Hadoop:service=NameNode,name=FSNamesystem:

SylvainJuge commented 1 week ago

For cassandra:

There is no mapping in YAML, the mapping is verbose and the lack of support for templates or string interpolation would make it quite tedious to write, but it's more an annoyance than a really blocking issue.

For example, few examples of MBeans:

There isn't anything that could not be mapped using YAML syntax.

robsunday commented 1 week ago

For activemq everything except property descriptions seems to be in sync. Metric attributes are consitent.

All desc fields in properties needs to be synchronized because wording is different

robsunday commented 1 week ago

solr case is very similar to hbase. No YAML at the moment but creating it should not be an issue.

SylvainJuge commented 1 week ago

For kafka, the YAML is kafka-broker.yaml

JMX: kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec:

I haven't checked in detail all the others, but they look identical between the two implementations.

I discovered that we have a way to use multiple mbeans names with the same metrics definition as seen in kafka-broker.yaml

For kafka-consumer.groovy and kafka-producer.groovy there is no equivalent YAML mapping though.