Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OTEL Synchronous Gauge #3647

Closed
ivan-zaitsev opened this issue Apr 15, 2024 · 3 comments
Closed

Support for OTEL Synchronous Gauge #3647

ivan-zaitsev opened this issue Apr 15, 2024 · 3 comments

Comments

@ivan-zaitsev
Copy link

ivan-zaitsev commented Apr 15, 2024

Expected behavior

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder;
import io.opentelemetry.api.incubator.metrics.LongGauge;

LongGauge gauge = ((ExtendedLongGaugeBuilder) GlobalOpenTelemetry.getMeter("meter").gaugeBuilder("gauge").ofLongs()).build();
gauge.set(1);

Otel PR: open-telemetry/opentelemetry-java#5506

Actual behavior

java.lang.ClassCastException: class io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongGaugeBuilder cannot be cast to class io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder (io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_10.metrics.ApplicationLongGaugeBuilder and io.opentelemetry.api.incubator.metrics.ExtendedLongGaugeBuilder are in unnamed module of loader 'app')

System information

SDK version: 3.5.1
Spring boot version 3.2.4

@trask
Copy link
Member

trask commented Apr 23, 2024

hi @ivan-zaitsev, it looks like you may be using older versions of OpenTelemetry API and OpenTelemetry Incubator, can you double check that you are using 1.36.0 for both io.opentelemetry:opentelemetry-api and io.opentelemetry:opentelemetry-api-incubator

also double check that the Spring dependency management isn't overriding the dependency versions you specify, check out https://opentelemetry.io/docs/languages/java/instrumentation/#dependency-management

@ivan-zaitsev
Copy link
Author

Thanks @trask I will be able to try it next week.

@ivan-zaitsev
Copy link
Author

With last 3.5.2 version it works. I think that it uses opentelemetry-runtime-attach-core 1.34.0-alpha.
With version 3.5.1 it doesn't work. It uses opentelemetry-runtime-attach-core 1.32.0-alpha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants