Package io.opentelemetry.sdk.trace
Class SdkTracerProviderBuilder
java.lang.Object
io.opentelemetry.sdk.trace.SdkTracerProviderBuilder
Builder of
SdkTracerProvider.-
Method Summary
Modifier and TypeMethodDescriptionaddResource(Resource resource) Merge aResourcewith the current.addSpanProcessor(SpanProcessor spanProcessor) Add a SpanProcessor to the span pipeline that will be built.build()Create a newSdkTracerProviderinstance with the configuration.Assign aClock.setIdGenerator(IdGenerator idGenerator) Assign anIdGenerator.setResource(Resource resource) Assign aResourceto be attached to all Spans created by Tracers.setSampler(Sampler sampler) Assign aSamplerto use for sampling traces.setSpanLimits(SpanLimits spanLimits) Assign an initialSpanLimitsthat should be used with this SDK.setSpanLimits(Supplier<SpanLimits> spanLimitsSupplier) Assign aSupplierofSpanLimits.
-
Method Details
-
setClock
Assign aClock.Clockwill be used each time aSpanis started, ended or any event is recorded.The
clockmust be thread-safe and return immediately (no remote calls, as contention free as possible).- Parameters:
clock- The clock to use for all temporal needs.- Returns:
- this
-
setIdGenerator
Assign anIdGenerator.IdGeneratorwill be used each time aSpanis started.The
idGeneratormust be thread-safe and return immediately (no remote calls, as contention free as possible).- Parameters:
idGenerator- A generator for trace and span ids.- Returns:
- this
-
setResource
Assign aResourceto be attached to all Spans created by Tracers.- Parameters:
resource- A Resource implementation.- Returns:
- this
-
addResource
Merge aResourcewith the current.- Parameters:
resource-Resourceto merge with current.- Since:
- 1.29.0
-
setSpanLimits
Assign an initialSpanLimitsthat should be used with this SDK.This method is equivalent to calling
setSpanLimits(Supplier)like this#setSpanLimits(() -> spanLimits).- Parameters:
spanLimits- the limits that will be used for everySpan.- Returns:
- this
-
setSpanLimits
Assign aSupplierofSpanLimits.SpanLimitswill be retrieved each time aSpanis started.The
spanLimitsSuppliermust be thread-safe and return immediately (no remote calls, as contention free as possible).- Parameters:
spanLimitsSupplier- the supplier that will be used to retrieve theSpanLimitsfor everySpan.- Returns:
- this
-
setSampler
Assign aSamplerto use for sampling traces.Samplerwill be called each time aSpanis started.The
samplermust be thread-safe and return immediately (no remote calls, as contention free as possible).- Parameters:
sampler- theSamplerto use for sampling traces.- Returns:
- this
-
addSpanProcessor
Add a SpanProcessor to the span pipeline that will be built.SpanProcessorwill be called each time aSpanis started or ended.The
spanProcessormust be thread-safe and return immediately (no remote calls, as contention free as possible).- Parameters:
spanProcessor- the processor to be added to the processing pipeline.- Returns:
- this
-
build
Create a newSdkTracerProviderinstance with the configuration.- Returns:
- The instance.
-