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
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTracerSdkProvider.BuilderBuilder class for the TraceSdkProvider.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSpanProcessor(SpanProcessor spanProcessor)Adds a newSpanProcessorto thisTracer.static TracerSdkProvider.Builderbuilder()Returns a newTracerSdkProvider.BuilderforTracerSdkProvider.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 TracerSdkProvider.Builder builder()
Returns a newTracerSdkProvider.BuilderforTracerSdkProvider.- Returns:
- a new
TracerSdkProvider.BuilderforTracerSdkProvider.
-
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:TracerSdkManagementReturns the activeTraceConfig.- Specified by:
getActiveTraceConfigin interfaceTracerSdkManagement- Returns:
- the active
TraceConfig.
-
updateActiveTraceConfig
public void updateActiveTraceConfig(TraceConfig traceConfig)
Description copied from interface:TracerSdkManagementUpdates the activeTraceConfig.Note: To update the
TraceConfigassociated with this instance you should use theTraceConfig.toBuilder()method on theTraceConfigreturned fromTracerSdkManagement.getActiveTraceConfig(), make the changes desired to theTraceConfig.Builderinstance, then use this method with the resultingTraceConfiginstance.- Specified by:
updateActiveTraceConfigin interfaceTracerSdkManagement- Parameters:
traceConfig- the new activeTraceConfig.- See Also:
TraceConfig
-
addSpanProcessor
public void addSpanProcessor(SpanProcessor spanProcessor)
Description copied from interface:TracerSdkManagementAdds 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
MultiSpanExporter.- Specified by:
addSpanProcessorin interfaceTracerSdkManagement- Parameters:
spanProcessor- the newSpanProcessorto be added.
-
shutdown
public void shutdown()
Description copied from interface:TracerSdkManagementAttempts 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 all the newly created
Spans will be no-op.- Specified by:
shutdownin interfaceTracerSdkManagement
-
forceFlush
public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
Description copied from interface:TracerSdkManagementRequests 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 interfaceTracerSdkManagement- See Also:
SpanProcessor.forceFlush()
-
-