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

JAX-RS endpoints annotated with WithSpan lose information and parent #25002

Closed
JapuDCret opened this issue Apr 19, 2022 · 2 comments · Fixed by #26326
Closed

JAX-RS endpoints annotated with WithSpan lose information and parent #25002

JapuDCret opened this issue Apr 19, 2022 · 2 comments · Fixed by #26326
Assignees
Labels
area/tracing kind/bug Something isn't working triage/invalid This doesn't seem right
Milestone

Comments

@JapuDCret
Copy link

Describe the bug

In OpenTracing it was possible to override the operationName of an automatically created Span of JAX-RS endpoints by using @Traced. This is no longer possible with opentelemetry-java. Also it seems that the connection to the previous span is lost (see screenshots)

See opentelemetry-java#4391

Expected behavior

  • Without annotating our REST-APIs with @WithSpan(..)
    • Complete Trace
      2022-04-19 14_55_28-Jaeger UI — Firefox Developer Edition
    • First Span
      2022-04-19 14_56_11-Jaeger UI — Firefox Developer Edition

Actual behavior

  • With annotating our REST-APIs with @WithSpan(..)
    • Complete Trace
      2022-04-19 14_55_43-Jaeger UI — Firefox Developer Edition
    • First Span
      2022-04-19 14_56_25-Jaeger UI — Firefox Developer Edition

How to Reproduce?

Annotate your JAX-RS REST endpoint with @WithSpan(..), see:

    @WithSpan("Create new Carrier")
    @POST
    @Path("/carriers")
    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response createCarrier(
            final NewCarrierDTO newCarrierDto
    ) {
        return Response
                .status(Response.Status.CREATED)
                .entity(applicationService.createNewCarrier(newCarrierDto))
                .build();
    }

We are using Quarkus 2.7.2.Final, which also defines the following Dependency versions:

We are using the following dependencies:

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-opentelemetry-exporter-otlp</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-extension-trace-propagators</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry.instrumentation</groupId>
            <artifactId>opentelemetry-jdbc</artifactId>
        </dependency>

Output of uname -a or ver

MINGW64_NT-10.0-19043 DESKTOP-55VO1DT 3.1.7-340.x86_64 2020-09-22 19:03 UTC x86_64 Msy

Output of java -version

AdoptOpenJDK (build 11.0.10+9)

GraalVM version (if different from Java)

n/a

Quarkus version or git rev

2.7.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

n/a

@quarkus-bot
Copy link

quarkus-bot bot commented Apr 21, 2022

/cc @Ladicek, @radcortez

@radcortez radcortez self-assigned this Apr 26, 2022
@radcortez radcortez added this to Backlog in Observability roadmap [Deprecated] via automation Jun 20, 2022
@radcortez radcortez moved this from Backlog to In progress in Observability roadmap [Deprecated] Jun 20, 2022
@radcortez
Copy link
Member

The @Trace is from MP OpenTracing and not from OpenTracing directly. I believe that OpenTracing did not have a way to override the REST endpoint span name natively.

OpenTelemetry also does not have an API to override the name. The span name is generated using the rules defined in the semantic conventions: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/README.md. It is unlikely for us to add such a feature since we want to remain as close as possible to the OpenTelemetry specification.

The @WithSpan annotation is not intended to use to override the name but to create a new span: https://github.com/open-telemetry/opentelemetry-java/blob/main/extensions/annotations/src/main/java/io/opentelemetry/extension/annotations/WithSpan.java#L14-L27

And because @WithSpan creates a new span, the information is not lost. Every span after the @WithSpan will be under a new parent, but still part of the same trace.

@radcortez radcortez added the triage/invalid This doesn't seem right label Jun 23, 2022
Observability roadmap [Deprecated] automation moved this from In progress to Done Jun 24, 2022
@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tracing kind/bug Something isn't working triage/invalid This doesn't seem right
Development

Successfully merging a pull request may close this issue.

3 participants