Class DefaultInMemoryTracer.Builder
- java.lang.Object
-
- io.servicetalk.opentracing.inmemory.DefaultInMemoryTracer.Builder
-
- Enclosing class:
- DefaultInMemoryTracer
public static final class DefaultInMemoryTracer.Builder extends java.lang.Object
Builders forDefaultInMemoryTracer
.
-
-
Constructor Summary
Constructors Constructor Description Builder(InMemoryScopeManager scopeManager)
Constructs a builder for anDefaultInMemoryTracer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultInMemoryTracer.Builder
addListener(InMemorySpanEventListener listener)
Add a trace event listener.DefaultInMemoryTracer
build()
Builds theDefaultInMemoryTracer
.DefaultInMemoryTracer.Builder
persistLogs(boolean persistLogs)
Sets whether logs are persisted in the span object.DefaultInMemoryTracer.Builder
use128BitTraceId(boolean use128BitTraceId)
Sets whether to use 128-bit trace IDs.DefaultInMemoryTracer.Builder
withMaxTagSize(int maxTagSize)
Sets the maximum number of tags.DefaultInMemoryTracer.Builder
withSampler(java.util.function.BiFunction<java.lang.String,java.lang.Boolean,java.lang.Boolean> sampler)
Sets the sampler.DefaultInMemoryTracer.Builder
withSampler(java.util.function.Predicate<java.lang.String> sampler)
Sets the sampler.
-
-
-
Constructor Detail
-
Builder
public Builder(InMemoryScopeManager scopeManager)
Constructs a builder for anDefaultInMemoryTracer
.- Parameters:
scopeManager
- aInMemoryScopeManager
.
-
-
Method Detail
-
withSampler
public DefaultInMemoryTracer.Builder withSampler(java.util.function.Predicate<java.lang.String> sampler)
Sets the sampler.- Parameters:
sampler
- policy which takes a traceId and returns whether the given trace should be sampled- Returns:
- this
-
withSampler
public DefaultInMemoryTracer.Builder withSampler(java.util.function.BiFunction<java.lang.String,java.lang.Boolean,java.lang.Boolean> sampler)
Sets the sampler.- Parameters:
sampler
- policy which takes a traceId and the sampling flag specified in carrier (optional, could benull
), and returns whether the given trace should be sampled.- Returns:
- this
-
addListener
public DefaultInMemoryTracer.Builder addListener(InMemorySpanEventListener listener)
Add a trace event listener.- Parameters:
listener
- listener to add- Returns:
- this
-
withMaxTagSize
public DefaultInMemoryTracer.Builder withMaxTagSize(int maxTagSize)
Sets the maximum number of tags.- Parameters:
maxTagSize
- maximum number of tags- Returns:
- this
-
persistLogs
public DefaultInMemoryTracer.Builder persistLogs(boolean persistLogs)
Sets whether logs are persisted in the span object. This is necessary when using using listeners which sends the span to a backend on span finish.- Parameters:
persistLogs
- whether to persist logs in the span object. Defaults to false.- Returns:
- this
-
use128BitTraceId
public DefaultInMemoryTracer.Builder use128BitTraceId(boolean use128BitTraceId)
Sets whether to use 128-bit trace IDs.- Parameters:
use128BitTraceId
- whether to use 128-bit trace IDs.- Returns:
- this
-
build
public DefaultInMemoryTracer build()
Builds theDefaultInMemoryTracer
.- Returns:
- tracer
-
-