Skip to content

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Oct 29, 2025

Fixes #14191

@zeitlinger
Copy link
Member Author

I'm getting

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

@laurit can you give me a hint?

@laurit
Copy link
Contributor

laurit commented Oct 30, 2025

I'm getting

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

@laurit can you give me a hint?

I thin you forgot to actually use the ApplicationOpenTelemetry155Incubator that you added. Have a look at

@zeitlinger
Copy link
Member Author

Thanks @laurit - can you check if this PR together with the SDK PR make sense (see ticket description)?

@zeitlinger zeitlinger marked this pull request as draft October 30, 2025 12:29
@zeitlinger zeitlinger force-pushed the instrument-extended-open-telemetry branch from 751e093 to e7a46a5 Compare November 8, 2025 10:55
@zeitlinger zeitlinger marked this pull request as ready for review November 8, 2025 11:30
@zeitlinger
Copy link
Member Author

opentelemetry-api-1.47 has this error - not sure what the problem is

    [otel.javaagent 2025-11-08 12:09:21:713 +0100] [Test worker] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - Instrumentation skipped, mismatched references were found: opentelemetry-api [class io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_56.incubator.OpenTelemetryApiIncubatorInstrumentationModule] on jdk.internal.loader.ClassLoaders$AppClassLoader@76ed5528
    [otel.javaagent 2025-11-08 12:09:21:729 +0100] [Test worker] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_56.incubator.ApplicationOpenTelemetry156Incubator:39 Missing class io.opentelemetry.api.incubator.config.ConfigProvider
    [otel.javaagent 2025-11-08 12:09:21:729 +0100] [Test worker] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_56.incubator.ApplicationOpenTelemetry156Incubator:0 Missing class io.opentelemetry.api.incubator.ExtendedOpenTelemetry
    [otel.javaagent 2025-11-08 12:09:21:729 +0100] [Test worker] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_56.incubator.config.ApplicationDeclarativeConfigProperties156Incubator:0 Missing class io.opentelemetry.api.incubator.config.DeclarativeConfigProperties

@zeitlinger
Copy link
Member Author

@laurit can you help with the error?

@zeitlinger
Copy link
Member Author

@laurit can you help with the error?

I think I figured it out 😄


@Override
public <T> Iterable<T> load(Class<T> type) {
return componentLoader.load(type);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this really work? I'd imagine that it will return agent classes that the application code can not process. Without thinking about it too much I'm not even sure it is possible to implement this.

Copy link
Member Author

Choose a reason for hiding this comment

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

right - I can't think of a use case where this is needed after the SDK has been set up. Maybe just throw a helpful exception?

Copy link
Contributor

Choose a reason for hiding this comment

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

either exception or an empty iterable, idk which would be preferable here. cc @trask

@zeitlinger zeitlinger force-pushed the instrument-extended-open-telemetry branch from e6e78cc to b673cb8 Compare November 11, 2025 13:50
@laurit laurit added this to the v2.22.0 milestone Nov 12, 2025
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.

Add instrumentation for ExtendedOpenTelemetry

2 participants