Skip to content

Conversation

@SylvainJuge
Copy link
Contributor

@SylvainJuge SylvainJuge commented Nov 20, 2025

There was an oversight in #15220, which I unfortunately only discovered when plumbing this new API in jmx-scraper with open-telemetry/opentelemetry-java-contrib#2446.

This PR adds a more versatile JmxTelemetryBuilder#addRules as replacement, this allows to load JMX metrics rules from any InputStream, not only the classpath resources in jmx/rules.

The following methods are not yet annotated with @Deprecated to prevent having to deal with changes when the dependency of contrib to instrumentation is updated, they should be replaced with JmxTelemetryBuilder#addRules in the future:

  • JmxTelemetryBuilder#addClassPathRules
  • JmxTelemetryBuilder#addCustomRules

This limitation currently makes loading "legacy" metrics definitions in jmx-scraper more complicated than necessary (see open-telemetry/opentelemetry-java-contrib#2446 for details).

Comment on lines 32 to 33
.hasMessageContaining("not found")
.hasMessageContaining("should-not-exist");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] the wrong exception message was provided here due to the too broad Exception catch clause.

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 this pull request may close these issues.

2 participants