We have Jaeger setup to trace calls primarily between the istio proxies. I'm trying to use tracing inside the application, include any traceId/spanIds in the logs and report back to the Jaeger collector any spans created within the application.
Most of our microservices still run Spring Boot 2. Some are already upgraded to Spring Boot 3.
I've got it to work satisfactory within Spring Boot2.
I included the following dependencies:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.opentracing.brave</groupId>
<artifactId>brave-opentracing</artifactId>
</dependency>
And set the following in the application.yaml
spring:
application:
name: our-service
sleuth:
propagation:
type: B3,W3C
opentracing:
enabled: true
zipkin:
base-url: <url to our jaeger collector>:9411
For our spring boot 3 application I added the following dependencies instead of the ones above:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
And added the same configuration to the application.yaml as above, but have additionally added:
logging:
pattern:
level: "%5p [${spring.application.name},%X{traceId:-},%X{spanId:-}]"
When I have both applications running in our test environment, I can see the traceIds showing up in the logs of both applications and I can find those traceIds in the jaeger UI as well, including spans created within the SpringBoot 2 application. Except for the spanId that is supposed to come from the SpringBoot 3 application. That application has the matching traceIds in the logs, but I also have the following error:
2023-03-16T15:36:15.037Z WARN [our-service,,] 1 --- [ender@207ff82c}] z.r.AsyncReporter$BoundedAsyncReporter : Dropped 1 spans due to ResourceAccessException(I/O error on POST request for "http://localhost:9411/api/v2/spans": Connection refused
Which makes me conclude that the configuration to set the url to the Jaeger collector should be different in Spring Boot 3 as it is not picking up my configured url, but uses http://localhost. But I can't seem to find anywhere how I'm supposed to configure it.
Hoping anyone here can help me out and can tell me what I'm doing wrong.