Class ExemplarSampler
There are two types of Exemplars: Regular exemplars are sampled implicitly if a supported tracing library is detected. Custom exemplars are provided explicitly in code, for example if a developer wants to make sure an Exemplar is created for a specific code path.
Spans will be marked as being an Exemplar by calling SpanContext.markCurrentSpanAsExemplar()
. The tracer implementation should set a Span attribute
to mark the current Span as an Exemplar. This attribute can be used by a trace sampling algorithm
to make sure traces with Exemplars are sampled.
The ExemplarSample is rate-limited, so only a small fraction of Spans will be marked as Exemplars in an application with a large number of requests.
See ExemplarSamplerConfig
for configuration options.
-
Constructor Summary
ConstructorDescriptionExemplarSampler
(ExemplarSamplerConfig config) ExemplarSampler
(ExemplarSamplerConfig config, SpanContext spanContext) Constructor with an additional {code spanContext} argument. -
Method Summary
-
Constructor Details
-
ExemplarSampler
-
ExemplarSampler
Constructor with an additional {code spanContext} argument. This is useful for testing, but may also be useful in some production scenarios. IfspanContext != null
that spanContext is used andSpanContextSupplier
is not used. IfspanContext == null
SpanContextSupplier.getSpanContext()
is called to find a span context.
-
-
Method Details
-
collect
-
reset
-
observe
-
observeWithExemplar
-