The Sampler interface allows users to create custom samplers which will return a SamplingResult based on information that is typically available just before the Span was created.
Definition at line 71 of file includes/opentelemetry/sdk/trace/sampler.h.

Public Member Functions | |
| virtual | ~Sampler ()=default |
| virtual SamplingResult | ShouldSample (const opentelemetry::trace::SpanContext &parent_context, opentelemetry::trace::TraceId trace_id, nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept=0 |
| Called during Span creation to make a sampling decision. More... | |
| virtual nostd::string_view | GetDescription () const noexcept=0 |
| Returns the sampler name or short description with the configuration. More... | |
| virtual | ~Sampler ()=default |
| virtual SamplingResult | ShouldSample (const opentelemetry::trace::SpanContext &parent_context, opentelemetry::trace::TraceId trace_id, nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept=0 |
| Called during Span creation to make a sampling decision. More... | |
| virtual nostd::string_view | GetDescription () const noexcept=0 |
| Returns the sampler name or short description with the configuration. More... | |
|
virtualdefault |
|
virtualdefault |
|
pure virtualnoexcept |
Returns the sampler name or short description with the configuration.
This may be displayed on debug pages or in the logs.
Implemented in sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::AlwaysOffSampler, and sdk::trace::AlwaysOffSampler.
|
pure virtualnoexcept |
Returns the sampler name or short description with the configuration.
This may be displayed on debug pages or in the logs.
Implemented in sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::TraceIdRatioBasedSampler, sdk::trace::AlwaysOffSampler, and sdk::trace::AlwaysOffSampler.
|
pure virtualnoexcept |
Called during Span creation to make a sampling decision.
| parent_context | a const reference to the SpanContext of a parent Span. An invalid SpanContext if this is a root span. |
| trace_id | the TraceId for the new Span. This will be identical to that in the parentContext, unless this is a root span. |
| name | the name of the new Span. |
| span_kind | the opentelemetry::trace::SpanKind of the Span. |
| attributes | list of AttributeValue with their keys. |
| links | Collection of links that will be associated with the Span to be created. |
Implemented in sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOffSampler, sdk::trace::AlwaysOffSampler, sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::TraceIdRatioBasedSampler, and sdk::trace::TraceIdRatioBasedSampler.
|
pure virtualnoexcept |
Called during Span creation to make a sampling decision.
| parent_context | a const reference to the SpanContext of a parent Span. An invalid SpanContext if this is a root span. |
| trace_id | the TraceId for the new Span. This will be identical to that in the parentContext, unless this is a root span. |
| name | the name of the new Span. |
| span_kind | the opentelemetry::trace::SpanKind of the Span. |
| attributes | list of AttributeValue with their keys. |
| links | Collection of links that will be associated with the Span to be created. |
Implemented in sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOnSampler, sdk::trace::AlwaysOffSampler, sdk::trace::AlwaysOffSampler, sdk::trace::ParentBasedSampler, sdk::trace::ParentBasedSampler, sdk::trace::TraceIdRatioBasedSampler, and sdk::trace::TraceIdRatioBasedSampler.