1

I am working with the Spring Boot application. I would like to add a TraceId to every request since it hits the application endpoint. In this context, I have added the dependency of spring-cloud-starter-sleuth similar to the following:

     <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
        <version>3.1.5</version>
    </dependency>

I did not do any other changes. It is not solving the problem of tracing a request from end to end.

1. No TraceId is coming in the request access log. Now it's coming something like below

[0:0:0:0:0:0:0:1] - - [09/Dec/2022:07:00:42 +0000] "GET /api/my-service/paginated?shared=false&size=15&page=0&isTemplate=false HTTP/1.1" 200 2121

As you can see, there is no trace id added to the log.

2. Secondly in the Hibernate query logs also, no TraceId is getting appended. One instance I am giving here for better understanding:

Hibernate: select myTable0_.name as nam1_22_0_ from myTable myTable0_ where myTable0_.name=?

3. Thirdly, in one request, I may need to call another service also owned by me, it's not getting propagated there as well. So, as of now, I am not able to trace any requests from end to end. This not only applies to APIs but also applies to schedulers as well. Could anyone please help here?

Joy
  • 4,197
  • 14
  • 61
  • 131

1 Answers1

0

Based on the log shared, it seems you have a custom logging pattern (maybe ?)

If thats right then you'll prolly need the configuration as shown here to see the traceId's in the logs.

Adnan Mamajiwala
  • 578
  • 3
  • 9
  • 21
  • After doing the changes as mentioned in the link, still the same, no trace id or span id in access log. – Joy Dec 18 '22 at 03:44