Skip to content

Commit 1f5f0d2

Browse files
authored
deprecate jmx gatherer + document migration (#2034)
1 parent 95c30f2 commit 1f5f0d2

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

jmx-metrics/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# JMX Metric Gatherer
22

3+
**Deprecation notice**: the JMX Metric Gatherer is deprecated and replaced by [JMX Scraper](../jmx-scraper/), see [migration instructions](../jmx-scraper/README.md#migration-from-jmx-gatherer).
4+
35
This utility provides an easy framework for gathering and reporting metrics based on queried
46
MBeans from a JMX server. It loads included and/or custom Groovy scripts and establishes a helpful,
57
bound `otel` object with methods for obtaining MBeans and constructing OpenTelemetry instruments:

jmx-scraper/README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ This utility provides a way to query JMX metrics and export them to an OTLP endp
44
The JMX MBeans and their metric mappings are defined in YAML and reuse implementation from
55
[jmx-metrics instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/jmx-metrics).
66

7-
This is currently a work-in-progress component not ready to be used in production.
8-
The end goal is to provide an alternative to the [JMX Gatherer](../jmx-metrics/README.md) utility.
7+
This is an alternative to the [JMX Gatherer](../jmx-metrics/README.md) utility.
98

109
## Usage
1110

@@ -136,6 +135,45 @@ When doing so, the `java -jar` command can´t be used, we have to provide the cl
136135
java -cp scraper.jar:jboss-client.jar io.opentelemetry.contrib.jmxscraper.JmxScraper <config>
137136
```
138137

138+
## Migration from JMX Gatherer
139+
140+
The JMX Scraper aims to replace the [JMX Gatherer](../jmx-metrics) tool and thus share most features
141+
and configuration with it.
142+
143+
Features not supported:
144+
145+
- Define and capture metrics with custom Groovy definitions with `otel.jmx.groovy.script`, this is now replaced with YAML and `otel.jmx.config` configuration option.
146+
- Ability to export to prometheus collector, only the OTLP exporter is included.
147+
148+
The YAML-based implementation is provided by [java instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/jmx-metrics)
149+
and thus should be used for syntax details and documentation.
150+
151+
Like with the JMX Gatherer, the selection of provided metrics to use is still done with `otel.jmx.target.system` configuration option.
152+
153+
However, there is now two distinct sets of metrics to select from using the `otel.jmx.target.source` configuration option:
154+
155+
- `legacy`: [metrics definitions](./src/main/resources) equivalent to JMX Gatherer definitions to help transition and preserve compatibility
156+
- `instrumentation`: [metrics definitions inherited from instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/jmx-metrics/library/src/main/resources/jmx/rules/), which is now used as a reference for JMX metrics, those also aim to provide better alignment with [metrics semantic conventions](https://opentelemetry.io/docs/specs/semconv/general/metrics/).
157+
158+
In both cases, the metrics definitions themselves are embedded in the JMX Scraper binary, thus they
159+
will only change if the release version of the JMX Scraper binary changes.
160+
161+
By default, `otel.jmx.target.source` is `auto`, which means for each value of `otel.jmx.target.system`:
162+
163+
- Metrics definitions from instrumentation will be used by default, if available.
164+
- Legacy metrics definitions equivalent to JMX Gatherer will be used as fallback.
165+
- Whenever new metrics definitions are being added or modified in instrumentation, those newer definitions will be used.
166+
167+
There are multiple possible strategies depending on the ability or willingness to embrace change in metrics definitions:
168+
169+
- To preserve maximum compatibility, using `legacy` is the recommended option, however it means to not benefit from future updates and contributions.
170+
- To only get the most recent definitions, using `instrumentation` ensures that none of the legacy definitions is used, only the reference from instrumentation closer to semconv recommendations, those could still evolve over time.
171+
- To embrace reference definitions whenever they become available, using `auto` is the recommended option, however it means the metrics produced could change when updating the version of JMX Scraper.
172+
- To handle more complex migration strategies or for tight control of metrics definitions, using copies of the YAML metrics definitions and providing them explicitly with `otel.jmx.config` is the recommended option.
173+
174+
When using `otel.target.source` = `auto` or `legacy`, one or more legacy definitions might be used. If strict compatibility with metrics produced by JMX Gatherer is required it is recommended to review
175+
the [legacy metrics definitions YAML files](./src/main/resources/) as they contain comments on the minor differences with JMX Gatherer Groovy definitions.
176+
139177
## Component owners
140178

141179
- [Jason Plumb](https://github.com/breedx-splk), Splunk

0 commit comments

Comments
 (0)