In a spring boot application (just one at the moment) I included jaeger by adding dependency opentracing-spring-jaeger-web-starter
and the below beans
@Bean
public static JaegerTracer getTracer() {
io.jaegertracing.Configuration.SamplerConfiguration samplerConfig =
io.jaegertracing.Configuration.SamplerConfiguration.fromEnv().withType("const").withParam(1);
io.jaegertracing.Configuration.ReporterConfiguration reporterConfig =
io.jaegertracing.Configuration.ReporterConfiguration.fromEnv().withLogSpans(true);
io.jaegertracing.Configuration config = new io.jaegertracing.Configuration("fooService").withSampler(samplerConfig).withReporter(reporterConfig);
return config.getTracer();
}
@PostConstruct
public void setProperty() {
System.setProperty("JAEGER_REPORTER_LOG_SPANS", "true");
}
After starting Jaeger in docker docker run -d --name jaeger -p 16686:16686 -p 6831:6831/udp jaegertracing/all-in-one:1.9
I get the traces.
I found now another dependency and read different tutorials which made me somehow unsure on what is the right way to use Jaeger with spring boot.
Which dependency would I use?
https://github.com/opentracing-contrib/java-spring-cloud
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-cloud-starter</artifactId>
</dependency>
https://github.com/signalfx/tracing-examples/tree/master/jaeger-java-spring-boot-web
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-web-starter</artifactId>
</dependency>
Following the Jaeger documentation possibly
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-client</artifactId>
<version>$jaegerVersion</version>
</dependency>
would be enough!?
Before trying Jaeger I used Zipkin which is very easy to integrate in Spring since there is a starter for sleuth. The logs contain trace and span id's in separate fields so they can be searched for e.g. in Kibana. Jaeger does not.
Can that be customized and if so - how?
Is it possibly to use Jaeger with Brave for instrumentation. The project e.g. includes spring-cloud-starter-sleuth
as a dependency. There are some conflicts with already existing beans. Can Jaeger be used with brave at all?