Tracing
Use this section when you want to create spans, propagate trace context, or work with Java libraries that depend on OpenTelemetry context.
Start here
- Create spans around effectful code
- Provide a no-op tracer
- Use unmanaged spans when a span must end outside its scope
- Trace Resource and fs2.Stream code
- Work with baggage
- Propagate trace context across service boundaries
- Use otel4s with Java-instrumented libraries
- Use otel4s with Pekko HTTP instrumentation
Related material
- For how
span,childScope,withParent,joinOrRoot,rootScope,rootSpan, andnoopScopeaffect parent-child relationships, see Choosing parent spans and tracing scopes. - When your application creates the OpenTelemetry SDK, keep otel4s context in sync with OpenTelemetry Java context: Keep otel4s context in sync with OpenTelemetry Java.
- When the standard OpenTelemetry Java agent or a framework owns the current Java context, use explicit context bridging at Java boundaries.
- For the mental model behind
Local, fiber-local context, and explicit scope re-entry, see How otel4s context propagation works. - For more background on
Resourceandfs2.Streamtracing scopes, see Tracing Resource and fs2.Stream scopes. - For the core tracing interfaces, see the Tracing API reference.