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

4.x Assigning Tracer.global(tracer) with the OpenTelemetry provider throws a spurious exception #9586

Closed
tjquinno opened this issue Dec 11, 2024 · 0 comments · Fixed by #9587
Assignees
Labels
4.x Version 4.x bug Something isn't working P2 tracing
Milestone

Comments

@tjquinno
Copy link
Member

Environment Details

  • Helidon Version: 4.x
  • Helidon SE or Helidon MP SE
  • JDK version:
  • OS:
  • Docker version (if applicable):

Problem Description

The Helidon tracing API allows developer code to set the global tracer by invoking Tracer.global(tracer).

Doing so when using the OpenTelemetry tracing provider causes an incorrect exception to be thrown:

Exception in thread "main" java.lang.IllegalArgumentException: Tracer must be an instance of Helidon OpenTelemetry tracer. Please use HelidonOpenTelemetry to create such instance
        at io.helidon.tracing.providers.opentelemetry.OpenTelemetryTracerProvider.global(OpenTelemetryTracerProvider.java:133)
        at io.helidon.tracing.TracerProviderHelper.global(TracerProviderHelper.java:80)
        at io.helidon.tracing.Tracer.global(Tracer.java:50)

This happens even if the provided tracer is indeed a HelidonOpenTelemetry object.

Steps to reproduce

With a dependency on helidon-tracing-providers-opentelemetry and helidon-tracing-api add code something like this:

        io.opentelemetry.api.trace.Tracer otelTracer = openTelemetry.getTracer(serviceName);
        Tracer helidonTracer = HelidonOpenTelemetry.create(openTelemetry, otelTracer, Map.of());
        Tracer.global(helidonTracer);

The last line triggers the exception even though the provided tracer is of the correct type.

@tjquinno tjquinno added bug Something isn't working tracing P2 4.x Version 4.x labels Dec 11, 2024
@tjquinno tjquinno added this to the 4.1.5 milestone Dec 11, 2024
@tjquinno tjquinno self-assigned this Dec 11, 2024
@tjquinno tjquinno added this to Backlog Dec 11, 2024
@github-project-automation github-project-automation bot moved this to Triage in Backlog Dec 11, 2024
@tjquinno tjquinno moved this from Triage to Sprint Scope in Backlog Dec 11, 2024
@github-project-automation github-project-automation bot moved this from Sprint Scope to Closed in Backlog Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x bug Something isn't working P2 tracing
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant