You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to configure custom SpanNameExtract for java HttpClient using opentelemetry-java-http-client instrumentation library.
However opentelemtetry sdk configured via javaagent.
Here is an example:
where openTelemetry obtained via: GlobalOpenTelemetry.get()
During startup I get class cast exception:
java.lang.ClassCastException: class io.opentelemetry.javaagent.shaded.io.opentelemetry.api.metrics.DefaultMeter$NoopDoubleHistogramBuilder cannot be cast to class io.opentelemetry.javaagent.shaded.io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder (io.opentelemetry.javaagent.shaded.io.opentelemetry.api.metrics.DefaultMeter$NoopDoubleHistogramBuilder and io.opentelemetry.javaagent.shaded.io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder are in unnamed module of loader 'bootstrap')
at io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_37.incubator.metrics.ApplicationDoubleHistogramBuilder137.setAttributesAdvice(ApplicationDoubleHistogramBuilder137.java:40)
at io.opentelemetry.instrumentation.api.semconv.http.HttpMetricsAdvice.applyClientDurationAdvice(HttpMetricsAdvice.java:31)
at io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics.<init>(HttpClientMetrics.java:59)
at io.opentelemetry.instrumentation.api.internal.OperationMetricsUtil.lambda$create$1(OperationMetricsUtil.java:68)
at io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder.buildOperationListeners(InstrumenterBuilder.java:320)
at io.opentelemetry.instrumentation.api.instrumenter.Instrumenter.<init>(Instrumenter.java:90)
at io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder.buildInstrumenter(InstrumenterBuilder.java:284)
at io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder.buildInstrumenter(InstrumenterBuilder.java:276)
at io.opentelemetry.instrumentation.httpclient.internal.JavaHttpClientInstrumenterFactory.createInstrumenter(JavaHttpClientInstrumenterFactory.java:70)
at io.opentelemetry.instrumentation.httpclient.JavaHttpClientTelemetryBuilder.build(JavaHttpClientTelemetryBuilder.java:124)
I'm passing OTEL_METRICS_EXPORTER = none as env variable, since I'm interested only in traces
Note:
If I add OTEL_METRICS_EXPORTER=logging, everything works as expected
Steps to reproduce
Set OTEL_METRICS_EXPORTER=none
Instrument application via javaagent
Try to create JavaHttpClientTelemetry by providing GlobalOpenTelemetry.get()
Expected behavior
If metrics exporter disable, instrumentation should not fail.
Describe the bug
I want to configure custom SpanNameExtract for java HttpClient using opentelemetry-java-http-client instrumentation library.
However opentelemtetry sdk configured via javaagent.
Here is an example:
where openTelemetry obtained via: GlobalOpenTelemetry.get()
During startup I get class cast exception:
I'm passing OTEL_METRICS_EXPORTER = none as env variable, since I'm interested only in traces
Note:
If I add OTEL_METRICS_EXPORTER=logging, everything works as expected
Steps to reproduce
Expected behavior
If metrics exporter disable, instrumentation should not fail.
Actual behavior
ClassCastException on initialization.
Javaagent or library instrumentation version
2.5.0
Environment
opentelemetry-api: 1.40.0
opentelemetry-java-http-client: 2.6.0-aplha
javaagent: 2.5.0
Additional context
I notice that in other place we have an instance of checks, like:
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpMetricsAdvice.java#L27
However it may be missed in:
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/opentelemetry-api/opentelemetry-api-1.37/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/v1_37/incubator/metrics/ApplicationDoubleHistogramBuilder137.java#L40
The text was updated successfully, but these errors were encountered: