Class SdkTracerProvider
- java.lang.Object
-
- io.opentelemetry.sdk.trace.SdkTracerProvider
-
- All Implemented Interfaces:
io.opentelemetry.api.trace.TracerProvider,SdkTracerManagement
public final class SdkTracerProvider extends Object implements io.opentelemetry.api.trace.TracerProvider, SdkTracerManagement
Tracerprovider 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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSpanProcessor(SpanProcessor spanProcessor)Adds a newSpanProcessorto thisTracer.static SdkTracerProviderBuilderbuilder()Returns a newSdkTracerProviderBuilderforSdkTracerProvider.io.opentelemetry.sdk.common.CompletableResultCodeforceFlush()Requests the active span processor to process all span events that have not yet been processed and returns aCompletableResultCodewhich is completed when the flush is finished.io.opentelemetry.api.trace.Tracerget(String instrumentationName)io.opentelemetry.api.trace.Tracerget(String instrumentationName, String instrumentationVersion)TraceConfiggetActiveTraceConfig()Returns the activeTraceConfig.voidshutdown()Attempts to stop all the activity for thisTracer.voidupdateActiveTraceConfig(TraceConfig traceConfig)Updates the activeTraceConfig.
-
-
-
Method Detail
-
builder
public static SdkTracerProviderBuilder builder()
Returns a newSdkTracerProviderBuilderforSdkTracerProvider.- Returns:
- a new
SdkTracerProviderBuilderforSdkTracerProvider.
-
get
public io.opentelemetry.api.trace.Tracer get(String instrumentationName)
- Specified by:
getin interfaceio.opentelemetry.api.trace.TracerProvider
-
get
public io.opentelemetry.api.trace.Tracer get(String instrumentationName, @Nullable String instrumentationVersion)
- Specified by:
getin interfaceio.opentelemetry.api.trace.TracerProvider
-
getActiveTraceConfig
public TraceConfig getActiveTraceConfig()
Description copied from interface:SdkTracerManagementReturns the activeTraceConfig.- Specified by:
getActiveTraceConfigin interfaceSdkTracerManagement- Returns:
- the active
TraceConfig.
-
updateActiveTraceConfig
public void updateActiveTraceConfig(TraceConfig traceConfig)
Description copied from interface:SdkTracerManagementUpdates the activeTraceConfig.Note: To update the
TraceConfigassociated with this instance you should use theTraceConfig.toBuilder()method on theTraceConfigreturned fromSdkTracerManagement.getActiveTraceConfig(), make the changes desired to theTraceConfigBuilderinstance, then use this method with the resultingTraceConfiginstance.- Specified by:
updateActiveTraceConfigin interfaceSdkTracerManagement- Parameters:
traceConfig- the new activeTraceConfig.- See Also:
TraceConfig
-
addSpanProcessor
public void addSpanProcessor(SpanProcessor spanProcessor)
Description copied from interface:SdkTracerManagementAdds a newSpanProcessorto thisTracer.Any registered processor cause overhead, consider to use an async/batch processor especially for span exporting, and export to multiple backends using the
SpanExporter.composite(SpanExporter...).- Specified by:
addSpanProcessorin interfaceSdkTracerManagement- Parameters:
spanProcessor- the newSpanProcessorto be added.
-
shutdown
public void shutdown()
Description copied from interface:SdkTracerManagementAttempts to stop all the activity for thisTracer. CallsSpanProcessor.shutdown()for all registeredSpanProcessors.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, newly created
Spans will be no-ops.After this is called, further attempts at re-using or reconfiguring this instance will result in undefined behavior. It should be considered a terminal operation for the SDK implementation.
- Specified by:
shutdownin interfaceSdkTracerManagement
-
forceFlush
public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
Description copied from interface:SdkTracerManagementRequests the active span processor to process all span events that have not yet been processed and returns aCompletableResultCodewhich is completed when the flush is finished.- Specified by:
forceFlushin interfaceSdkTracerManagement- See Also:
SpanProcessor.forceFlush()
-
-