The TraceIdRatioBased sampler computes and returns a decision based on the provided trace_id and the configured ratio.
Definition at line 24 of file includes/opentelemetry/sdk/trace/samplers/trace_id_ratio.h.
|
| | TraceIdRatioBasedSampler (double ratio) |
| |
| SamplingResult | ShouldSample (const opentelemetry::trace::SpanContext &, opentelemetry::trace::TraceId trace_id, nostd::string_view, opentelemetry::trace::SpanKind, const opentelemetry::common::KeyValueIterable &, const opentelemetry::trace::SpanContextKeyValueIterable &) noexcept override |
| |
| nostd::string_view | GetDescription () const noexcept override |
| |
| | TraceIdRatioBasedSampler (double ratio) |
| |
| SamplingResult | ShouldSample (const opentelemetry::trace::SpanContext &, opentelemetry::trace::TraceId trace_id, nostd::string_view, opentelemetry::trace::SpanKind, const opentelemetry::common::KeyValueIterable &, const opentelemetry::trace::SpanContextKeyValueIterable &) noexcept override |
| |
| nostd::string_view | GetDescription () const noexcept override |
| |
◆ TraceIdRatioBasedSampler() [1/2]
| sdk::trace::TraceIdRatioBasedSampler::TraceIdRatioBasedSampler |
( |
double |
ratio | ) |
|
|
explicit |
- Parameters
-
| ratio | a required value, 1.0 >= ratio >= 0.0. If the given trace_id falls into a given ratio of all possible trace_id values, ShouldSample will return RECORD_AND_SAMPLE. |
- Exceptions
-
| invalid_argument | if ratio is out of bounds [0.0, 1.0] |
◆ TraceIdRatioBasedSampler() [2/2]
| sdk::trace::TraceIdRatioBasedSampler::TraceIdRatioBasedSampler |
( |
double |
ratio | ) |
|
|
explicit |
- Parameters
-
| ratio | a required value, 1.0 >= ratio >= 0.0. If the given trace_id falls into a given ratio of all possible trace_id values, ShouldSample will return RECORD_AND_SAMPLE. |
- Exceptions
-
| invalid_argument | if ratio is out of bounds [0.0, 1.0] |
◆ GetDescription() [1/2]
◆ GetDescription() [2/2]
◆ ShouldSample() [1/2]
| SamplingResult sdk::trace::TraceIdRatioBasedSampler::ShouldSample |
( |
const opentelemetry::trace::SpanContext & |
, |
|
|
opentelemetry::trace::TraceId |
trace_id, |
|
|
nostd::string_view |
, |
|
|
opentelemetry::trace::SpanKind |
, |
|
|
const opentelemetry::common::KeyValueIterable & |
, |
|
|
const opentelemetry::trace::SpanContextKeyValueIterable & |
|
|
) |
| |
|
overridevirtualnoexcept |
- Returns
- Returns either RECORD_AND_SAMPLE or DROP based on current sampler configuration and provided trace_id and ratio. trace_id is used as a pseudorandom value in conjunction with the predefined ratio to determine whether this trace should be sampled
Implements sdk::trace::Sampler.
◆ ShouldSample() [2/2]
| SamplingResult sdk::trace::TraceIdRatioBasedSampler::ShouldSample |
( |
const opentelemetry::trace::SpanContext & |
, |
|
|
opentelemetry::trace::TraceId |
trace_id, |
|
|
nostd::string_view |
, |
|
|
opentelemetry::trace::SpanKind |
, |
|
|
const opentelemetry::common::KeyValueIterable & |
, |
|
|
const opentelemetry::trace::SpanContextKeyValueIterable & |
|
|
) |
| |
|
overridevirtualnoexcept |
- Returns
- Returns either RECORD_AND_SAMPLE or DROP based on current sampler configuration and provided trace_id and ratio. trace_id is used as a pseudorandom value in conjunction with the predefined ratio to determine whether this trace should be sampled
Implements sdk::trace::Sampler.
The documentation for this class was generated from the following file: