Reputation: 1
I am using below GitHub link to setup opentracing with Jaeger for microservices hosted in kubernetes env and it works fine for Java apps like Jenkins. https://github.com/lucas-matt/auto-tracing-webhook
https://medium.com/opentracing/opentracing-on-kubernetes-get-yer-tracing-for-free-7a69cca03c8a
However when I try to setup tracing for any Spring Boot application, it does not show any tracing in Jaeger UI.
After some research, I found that I need to add some starter code to trace Spring Boot application as given in below GitHub. However I am confused now, where to add this starter code.
https://github.com/opentracing-contrib/java-spring-jaeger
I am using below agent to trace and seems like I need to add some flag for Spring Boot here but I am not getting exactly.
JAVA_AGENT = ' -javaagent:/mnt/auto-trace/opentracing-specialagent-1.7.0.jar -Dsa.tracer=jaeger -Dsa.log.level=FINE'
Please suggest!
Upvotes: 0
Views: 1108
Reputation: 1906
I worked with Jaeger and springboot few years ago. In a dockerized environment, I remember you have to supply few environment variables to the application, something like:
JAEGER_AGENT_HOST=jaeger-agent.example.io
JAEGER_AGENT_PORT=5775
JAEGER_SAMPLER_TYPE=const
JAEGER_SAMPLER_PARAM=1
JAEGER_SAMPLER_MANAGER_HOST_PORT=jaeger-agent.example.io:5778
JAEGER_REPORTER_LOG_SPANS=true
Then, you need to define the bean:
@Bean
public io.opentracing.Tracer jaegerTracer() {
return new com.uber.jaeger.Configuration("myApp")
.withSampler(SamplerConfiguration.fromEnv())
.withReporter(ReporterConfiguration.fromEnv())
.getTracer();
}
Upvotes: 1