Skip to content

Migrate JMX module to declarative config API#15733

Merged
trask merged 1 commit intoopen-telemetry:mainfrom
trask:jmx
Dec 27, 2025
Merged

Migrate JMX module to declarative config API#15733
trask merged 1 commit intoopen-telemetry:mainfrom
trask:jmx

Conversation

@trask
Copy link
Copy Markdown
Member

@trask trask commented Dec 26, 2025

No description provided.

Comment on lines -213 to -216
// Handle jmx prefix: java.jmx.* → otel.jmx.*
if (translated.startsWith("jmx.")) {
return "otel." + translated;
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think better to limit this mapping to the current set of system properties so added them instead to SPECIAL_MAPPINGS

if (discoveryDelay != null) {
return discoveryDelay;
private static Duration beanDiscoveryDelay(
ExtendedDeclarativeConfigProperties config, ConfigProperties configProperties) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

will remove ConfigProperties later since it will be a breaking change as it's used to access otel.metric.export.interval below which isn't available via declarative config API

@trask trask marked this pull request as ready for review December 26, 2025 16:51
@trask trask requested a review from a team as a code owner December 26, 2025 16:51
@trask trask merged commit 08c56f0 into open-telemetry:main Dec 27, 2025
85 checks passed
@trask trask deleted the jmx branch December 27, 2025 16:42
Comment on lines +90 to +91
SPECIAL_MAPPINGS.put("java.jmx.discovery.delay", "otel.jmx.discovery.delay");
SPECIAL_MAPPINGS.put("java.jmx.target_system", "otel.jmx.target.system");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I missed this PR, but I think here we could probably have choosen target.system instead of target_system as with JMX Scraper we also have target.source, is there a particular reason to prefer one or the other ?

I've opened #15856 as an attempt to fix this with a target object then system sub-attribute, but maybe it's intentional and we prefer to keep it the way it is to prevent too much structure in config, I'm fine with any implications it could have on jmx-scraper. At the same time, the JMX scraper target.source option might go away in some distant future, but we are not there yet.

Also, with discovery.delay there is no other discovery.* configuration option, so for this one it could have made sense to use discovery_delay, unless we prefer to preserve the existing dotted structure or we know that other discovery-related configuration options will be needed later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think there was a particular reason - feel free to change both

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.

3 participants