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

OpenTelemetry's traceId and spanId not logged after RestClient call #27528

Closed
jv-nxtproj opened this issue Aug 26, 2022 · 3 comments
Closed

OpenTelemetry's traceId and spanId not logged after RestClient call #27528

jv-nxtproj opened this issue Aug 26, 2022 · 3 comments
Labels
area/smallrye area/tracing kind/bug Something isn't working triage/duplicate This issue or pull request already exists

Comments

@jv-nxtproj
Copy link

Describe the bug

OpenTelemetry's traceId and spanId not logged has been fixed recently #26562

However, there is a remaing issue when handling the result of a reactive rest client call

Resource

@Path("/hello")
public class GreetingResource {
   private static final Logger LOG = Logger.getLogger(GreetingResource.class);
   @Inject
   GreetingService service;

   @RestClient
   GreetingClient greetingClient;

   @SneakyThrows
   @GET
   @WithSpan
   @Produces(MediaType.TEXT_PLAIN)
   public CompletableFuture<String> hello() {
      LOG.info("generate uuid");
      String uuid = UUID.randomUUID().toString();
      LOG.info("loop " + uuid);
      return greetingClient.greeting("RESTEasy_Reactive_" + uuid)
            .thenApply(msg -> {
               LOG.info("back "+ msg);
               return msg;
            })
            .toCompletableFuture();
   }

   @GET
   @WithSpan
   @Produces(MediaType.TEXT_PLAIN)
   @Path("/greeting/{name}")
   public String greeting(String name) {
      String res = service.greeting(name);
      LOG.info(res);
      return res;
   }
}

Client

@Path("/hello")
@RegisterRestClient(configKey="greeting-api")
public interface GreetingClient {
   @GET
   @Path("/greeting/{name}")
   CompletionStage<String> greeting(@PathParam("name") String name);
}

Expected behavior

All traces related to one transaction should be logged under same id

Actual behavior

10:51:38 INFO  traceId=acf609ed27927c523adeef15e38c68d8, parentId=9a30b66aed506cc5, spanId=b861b34e21bc9556, sampled=true [co.nx.nx.ba.GreetingResource] (executor-thread-0) generate uuid
10:51:38 INFO  traceId=acf609ed27927c523adeef15e38c68d8, parentId=9a30b66aed506cc5, spanId=b861b34e21bc9556, sampled=true [co.nx.nx.ba.GreetingResource] (executor-thread-0) loop 40a7b65c-e5f2-4973-8acd-bf81bea9b72d
10:51:38 INFO  traceId=acf609ed27927c523adeef15e38c68d8, parentId=07b041e5a1404cde, spanId=8b77eafbcd574064, sampled=true [co.nx.nx.ba.GreetingResource] (executor-thread-0) hello RESTEasy_Reactive_40a7b65c-e5f2-4973-8acd-bf81bea9b72d
10:51:38 INFO  traceId=, parentId=, spanId=, sampled= [co.nx.nx.ba.GreetingResource] (vert.x-eventloop-thread-1) back hello RESTEasy_Reactive_40a7b65c-e5f2-4973-8acd-bf81bea9b72d

Last line (logged inside thenApply) has no traceId

How to Reproduce?

Perform GET http://localhost:8080/hello

Output of uname -a or ver

Linux dev-ptf 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 11.0.15+10-jvmci-22.1-b06)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

io.quarkus.platform.quarkus-bom.2.12.0.CR1

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

Apache Maven 3.8.6

Additional information

No response

@jv-nxtproj jv-nxtproj added the kind/bug Something isn't working label Aug 26, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 26, 2022

/cc @Ladicek, @brunobat, @radcortez

@brunobat
Copy link
Contributor

I believe this is a duplicate from RestClient Reactive, MDC lost
@jv-nxtproj do you agree?

@jv-nxtproj
Copy link
Author

@brunobat You're right.
I close this ticket.

@brunobat brunobat added the triage/duplicate This issue or pull request already exists label Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/smallrye area/tracing kind/bug Something isn't working triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants