Class CustomSampler
-
- All Implemented Interfaces:
-
com.launchdarkly.observability.sampling.ExportSampler
public final class CustomSampler implements ExportSampler
Custom sampler that uses a sampling configuration to determine if a span should be sampled.
-
-
Constructor Summary
Constructors Constructor Description CustomSampler(Function1<Integer, Boolean> sampler)
-
Method Summary
Modifier and Type Method Description Unit
setConfig(SamplingConfig config)
Boolean
isSamplingEnabled()
Returns true if sampling is enabled. SamplingResult
sampleSpan(SpanData span)
Sample a span based on the sampling configuration. SamplingResult
sampleLog(LogRecordData log)
Sample a log based on the sampling configuration. -
-
Method Detail
-
setConfig
Unit setConfig(SamplingConfig config)
-
isSamplingEnabled
Boolean isSamplingEnabled()
Returns true if sampling is enabled. If there are no sampling configurations, then sampling can be skipped.
-
sampleSpan
SamplingResult sampleSpan(SpanData span)
Sample a span based on the sampling configuration.
- Parameters:
span
- The span to sample.
-
sampleLog
SamplingResult sampleLog(LogRecordData log)
Sample a log based on the sampling configuration.
- Parameters:
log
- The log to sample.
-
-
-
-