Skip to content

Conversation

@jaydeluca
Copy link
Member

Contributes to #6947

@jaydeluca jaydeluca requested a review from a team as a code owner September 11, 2025 14:43
Comment on lines +34 to +46
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.jmx.engine.JmxMetricInsight;
import io.opentelemetry.instrumentation.jmx.engine.MetricConfiguration;

// Get an OpenTelemetry instance
OpenTelemetry openTelemetry = ...;

JmxMetricInsight jmxMetricInsight = JmxMetricInsight.createService(openTelemetry, 5000);

// Configure your JMX metrics
MetricConfiguration config = new MetricConfiguration();

jmxMetricInsight.startLocal(config);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately this does not conform to our usual practices. @SylvainJuge any plans to make this similar to our other library instrumentations?

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean exactly here ? Is it packaging the JMX metrics feature to be similar to other library components in the instrumentation repository ? For example support for auto-configuration or fitting an "idiomatic way" to setup and initialize ?

For example, there is currently no way to properly shut-down or disable the feature at runtime, which could be problematic in some case if we want to provide the ability to automatically re-connect to a remote JVM (which is not the case when executed locally within the JVM).

Copy link
Contributor

Choose a reason for hiding this comment

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

Other library instrumentations use have Telemetry/TelemetryBuilder as public api classes that users should interact with, idk if the same pattern would work here. Our library instrumentations provide minimal public api, this module has a bunch of public classes, are all of these intended to serve as the public api? If not you could move them to an internal package. The main package is io.opentelemetry.instrumentation.jmx.engine which does not match what other library insrumentations use.

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines 59 to 60
.addLast(clientTelemetry.createRequestHandler())
.addLast(clientTelemetry.createResponseHandler());
Copy link
Contributor

Choose a reason for hiding this comment

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

could use createCombinedHandler() to create both

NettyClientTelemetry clientTelemetry = NettyClientTelemetry.create(openTelemetry);

Bootstrap bootstrap = new Bootstrap();
bootstrap.group(new NioEventLoopGroup())
Copy link
Contributor

Choose a reason for hiding this comment

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

idk if that matters but NioEventLoopGroup has been deprecated in netty 4.2

@laurit laurit merged commit 17a0bde into open-telemetry:main Sep 16, 2025
89 checks passed
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