August 2019
Intermediate to advanced
256 pages
6h 43m
English
The application can inject an io.opentracing.Tracer bean that exposes the full OpenTracing API. This allows application developers to leverage more advanced use cases, such as adding metadata to the currently active span, manually creating spans, using baggage for context propagation, or initializing additional third-party instrumentation.
The following code shows how the tracer is used to attach data to the currently active span, (1):
@Path("/")public class Service { @Inject private Tracer tracer; @GET @Path("") @Produces(MediaType.TEXT_PLAIN) public String greeting() { tracer.activeSpan() .setTag("greeting", "hello"); (1) return "hello"; }}
This can be useful for adding business-related data to spans, but also to log ...
Read now
Unlock full access