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

Error handling with @WithSpan (OpenTelemetry) #33372

Closed
mskacelik opened this issue May 15, 2023 · 2 comments · Fixed by #33375
Closed

Error handling with @WithSpan (OpenTelemetry) #33372

mskacelik opened this issue May 15, 2023 · 2 comments · Fixed by #33375
Labels
area/tracing kind/bug Something isn't working
Milestone

Comments

@mskacelik
Copy link
Contributor

Describe the bug

If an exception occurs in a method that's annotated with @WithSpan, the error won't be recorded in the trace.

Expected behavior

Trace will contain error span.

Actual behavior

Currently the error span is missing from the trace. Or in the reproducer's case the entire trace is missing.

How to Reproduce?

Slightly modified TracedResources class from the OpenTelemetry quickstart. https://quarkus.io/guides/opentelemetry

package org.acme.opentelemetry;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import io.opentelemetry.instrumentation.annotations.WithSpan;
import org.jboss.logging.Logger;

@Path("/hello")
public class TracedResources {
    private static final Logger LOG = Logger.getLogger(TracedResources.class);

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(){
        LOG.info("hello");
        doSomething();
        return "hello";
    }

    @WithSpan
    public String doSomething() {
        throw new RuntimeException("foo");
    }
}

When the app is running, execute the command curl http://localhost:8080/hello and look at the trace result.

Output of uname -a or ver

No response

Output of java -version

openjdk version "17.0.5"

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

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

No response

Additional information

No response

@mskacelik mskacelik added the kind/bug Something isn't working label May 15, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented May 15, 2023

/cc @brunobat (opentelemetry), @radcortez (opentelemetry)

@brunobat
Copy link
Contributor

We are not adding exceptions to the span... Will submit a PR.

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
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants