Class ExemplarSampler

Object
ExemplarSampler

public class ExemplarSampler extends Object
The ExemplarSampler selects Spans as exemplars.

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.