Class TracerSdkProvider
- java.lang.Object
-
- io.opentelemetry.sdk.trace.TracerSdkProvider
-
- All Implemented Interfaces:
io.opentelemetry.api.trace.TracerProvider
,TracerSdkManagement
public class TracerSdkProvider extends Object implements io.opentelemetry.api.trace.TracerProvider, TracerSdkManagement
Tracer
provider implementation forTracerProvider
.This class is not intended to be used in application code and it is used only by
OpenTelemetry
. However, if you need a custom implementation of the factory, you can create one as needed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TracerSdkProvider.Builder
Builder class for the TraceSdkProvider.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSpanProcessor(SpanProcessor spanProcessor)
Adds a newSpanProcessor
to thisTracer
.static TracerSdkProvider.Builder
builder()
Returns a newTracerSdkProvider.Builder
forTracerSdkProvider
.io.opentelemetry.sdk.common.CompletableResultCode
forceFlush()
Requests the active span processor to process all span events that have not yet been processed and returns aCompletableResultCode
which is completed when the flush is finished.io.opentelemetry.api.trace.Tracer
get(String instrumentationName)
io.opentelemetry.api.trace.Tracer
get(String instrumentationName, String instrumentationVersion)
TraceConfig
getActiveTraceConfig()
Returns the activeTraceConfig
.void
shutdown()
Attempts to stop all the activity for thisTracer
.void
updateActiveTraceConfig(TraceConfig traceConfig)
Updates the activeTraceConfig
.
-
-
-
Method Detail
-
builder
public static TracerSdkProvider.Builder builder()
Returns a newTracerSdkProvider.Builder
forTracerSdkProvider
.- Returns:
- a new
TracerSdkProvider.Builder
forTracerSdkProvider
.
-
get
public io.opentelemetry.api.trace.Tracer get(String instrumentationName)
- Specified by:
get
in interfaceio.opentelemetry.api.trace.TracerProvider
-
get
public io.opentelemetry.api.trace.Tracer get(String instrumentationName, @Nullable String instrumentationVersion)
- Specified by:
get
in interfaceio.opentelemetry.api.trace.TracerProvider
-
getActiveTraceConfig
public TraceConfig getActiveTraceConfig()
Description copied from interface:TracerSdkManagement
Returns the activeTraceConfig
.- Specified by:
getActiveTraceConfig
in interfaceTracerSdkManagement
- Returns:
- the active
TraceConfig
.
-
updateActiveTraceConfig
public void updateActiveTraceConfig(TraceConfig traceConfig)
Description copied from interface:TracerSdkManagement
Updates the activeTraceConfig
.Note: To update the
TraceConfig
associated with this instance you should use theTraceConfig.toBuilder()
method on theTraceConfig
returned fromTracerSdkManagement.getActiveTraceConfig()
, make the changes desired to theTraceConfig.Builder
instance, then use this method with the resultingTraceConfig
instance.- Specified by:
updateActiveTraceConfig
in interfaceTracerSdkManagement
- Parameters:
traceConfig
- the new activeTraceConfig
.- See Also:
TraceConfig
-
addSpanProcessor
public void addSpanProcessor(SpanProcessor spanProcessor)
Description copied from interface:TracerSdkManagement
Adds a newSpanProcessor
to thisTracer
.Any registered processor cause overhead, consider to use an async/batch processor especially for span exporting, and export to multiple backends using the
MultiSpanExporter
.- Specified by:
addSpanProcessor
in interfaceTracerSdkManagement
- Parameters:
spanProcessor
- the newSpanProcessor
to be added.
-
shutdown
public void shutdown()
Description copied from interface:TracerSdkManagement
Attempts to stop all the activity for thisTracer
. CallsSpanProcessor.shutdown()
for all registeredSpanProcessor
s.This operation may block until all the Spans are processed. Must be called before turning off the main application to ensure all data are processed and exported.
After this is called all the newly created
Span
s will be no-op.- Specified by:
shutdown
in interfaceTracerSdkManagement
-
forceFlush
public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
Description copied from interface:TracerSdkManagement
Requests the active span processor to process all span events that have not yet been processed and returns aCompletableResultCode
which is completed when the flush is finished.- Specified by:
forceFlush
in interfaceTracerSdkManagement
- See Also:
SpanProcessor.forceFlush()
-
-