manual instrumentation
.
Use Cases
Examples of custom spans you might want to add to your code include:- Spans for the execution of some potentially heavy or slow computation in you service.
- Tracing for internal or third party libraries for which you don’t have automatic or integrated instrumentation.
- Spans to describe some logical operations in your business logic that are meaningful in your domain.
Required Dependencies
Add the following dependencies to your project:Creating Spans
To create a span, use theTracer
interface. The Tracer
interface is the main entry point for the OpenTelemetry API. It allows you to create spans and manage the current span.
Acquire a Tracer
instance using the OpenTelemetry
class:
Tracer
instance: