Skip to content

spring-cloud-samples/spring-cloud-sleuth-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java CI with Maven

Spring Cloud Sleuth Samples

This repository contains isolated samples showing various integrations with Spring Cloud Sleuth.

You can read more about the details of the instrumentation logic in each of the samples.

Turning on Wavefront support

Build the apps with the default and wavefront profile turned on. default will add Sleuth with Brave on the classpath.

. All projects and acceptance tests

$ ./mvnw clean install -Pdefault,wavefront

. Build one project

$ ./mvnw clean install -Pdefault,wavefront -pl task
$ # Run one app
$ java -jar task/target/task*.jar 

. Run one project (example for task)

$ ./mvnw -Pdefault,wavefront -pl task spring-boot:run

If you want to run the project from IDE remember to tick the default and wavefront profiles there too.

Turning on Zipkin support

Run Zipkin

$ docker run -d -p 9411:9411 openzipkin/zipkin

Build the apps with the default and zipkin profile turned on. default will add Sleuth with Brave on the classpath.

. All projects and acceptance tests

$ ./mvnw clean install -Pdefault,zipkin

. Build one project

$ ./mvnw clean install -Pdefault,zipkin -pl task
$ # Run one app
$ java -jar task/target/task*.jar 

. Run one project (example for task)

$ ./mvnw -Pdefault,zipkin -pl task spring-boot:run

If you want to run the project from IDE remember to tick the default and zipkin profiles there too.

Using OpenTelemetry

Instead of using the default profile please use the otel profile. So if you want to run otel based tracing with zipkin you need to build the application with both otel and zipkin profiles. Example:

. All projects and acceptance tests

$ ./mvnw clean install -Potel,zipkin

. Build one project

$ ./mvnw clean install -Potel,zipkin -pl task
$ # Run one app
$ java -jar task/target/task*.jar 

. Run one project (example for task)

$ ./mvnw -Potel,zipkin -pl task spring-boot:run

FAQ

The logging text makes no sense

You can see logs like this

log.info("<ACCEPTANCE_TEST> <TRACE:{}> Hello from producer", tracer.currentSpan().context().traceId());

or this

log.info("<ACCEPTANCE_TEST> <TRACE:{}> Hello from consumer", tracer.currentSpan().context().traceId());

even though there is no consumer / producer...

That's because in the acceptance tests we're using conventions and we're searching for exactly those entries in the logs to see if the context got properly propagated.

About

Contains isolated samples of Spring Cloud Sleuth

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages