TracerProvider class
SDK implementation of the APITracerProvider interface.
The TracerProvider is the entry point to the tracing API. It is responsible for creating and managing Tracers, as well as configuring the tracing pipeline via SpanProcessors and Exporters.
This implementation delegates some functionality to the API TracerProvider implementation while adding SDK-specific behaviors like span processor management and resource association.
Note: Per OTEP 0265: Event Vision and OTEP 4430: Span Event API deprecation plan, span events are planned for deprecation in favor of log-based events emitted via the Logs API; SDKs will provide options to render log-based events as span events for compatibility.
More information: https://opentelemetry.io/docs/specs/otel/trace/sdk/
- Implemented types
Properties
- enabled ↔ bool
-
Returns whether this tracer provider is enabled.
getter/setter pairoverride
- endpoint ↔ String
-
Gets the endpoint URL used by this tracer provider.
getter/setter pairoverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasSpanProcessors → bool
-
Whether any span processors are registered.
no setter
- isShutdown ↔ bool
-
Returns whether this tracer provider has been shut down.
getter/setter pairoverride
- resource ↔ Resource?
-
The resource associated with this provider.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampler ↔ Sampler?
-
The default sampler to use for new tracers.
getter/setter pair
- serviceName ↔ String
-
Gets the service name used by this tracer provider.
getter/setter pairoverride
- serviceVersion ↔ String?
-
Gets the service version used by this tracer provider.
getter/setter pairoverride
- spanExceptionOptions ↔ SpanExceptionOptions?
-
The default exception handling options applied by Tracer.withSpan /
Tracer.withSpanAsync for tracers created by this provider when no
per-call options are supplied.
getter/setter pair
-
spanProcessors
→ List<
SpanProcessor> -
Gets all registered span processors.
no setter
- timeProvider ↔ TimeProvider
-
Clock used for span start, end, and event timestamps. Delegates to the
underlying APITracerProvider so the SDK and API share a single
source of truth. Defaults are platform-aware (native:
SystemTimeProvider; web:WebTimeProvider); override viaOTel.initialize(timeProvider: ...)or by assigning here.getter/setter pairoverride
Methods
-
addSpanProcessor(
SpanProcessor processor) → void - Adds a span processor to this provider.
-
ensureResourceIsSet(
) → void - Ensures the resource for this provider is properly set.
-
forceFlush(
) → Future< void> - Forces all span processors to flush any queued spans.
-
getTracer(
String name, {String? version, String? schemaUrl, Attributes? attributes, Sampler? sampler}) → Tracer -
Returns a APITracer with the given
nameandversion.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shutdown(
) → Future< bool> -
Shuts down the TracerProvider.
After shutdown:
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited