Skip to content

Commit

Permalink
Migrating from the old repository at open-telemetry/oteps#250
Browse files Browse the repository at this point in the history
Merging from main
  • Loading branch information
PeterF778 committed Dec 20, 2024
1 parent 5e16460 commit db169b3
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion oteps/0250-Composite_Samplers.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ The `ConsistentAlwaysOn` sampler MUST provide a `SamplingIntent` with
- `GetAttributes` returning an empty set,
- `UpdateTraceState` returning its argument, without any modifications.


#### Constructing `SamplingResult`

The process of constructing the final `SamplingResult` in response to a call to `ShouldSample` on the root sampler of the composite samplers tree consists of the following steps.
Expand All @@ -238,6 +237,41 @@ This composite sampler re-uses the concept of Predicates from Approach One.

For calculating the `SamplingIntent`, if the `Span` kind matches the specified kind, the sampler goes through the list in the provided order and calls `SpanMatches` on `Predicate`s passing the same arguments as received. If a call returns `true`, the result is as returned by `GetSamplingIntent` called on the corresponding `ComposableSampler`. If the `SpanKind` does not match, or none of the calls to `SpanMatches` yield `true`, the result is obtained by calling `GetSamplingIntent` on `ConsistentAlwaysOffSampler`.

### ConsistentParentBased

The functionality of `ConsistentParentBased` sampler corresponds to the standard `ParentBased` sampler.
It takes one ComposableSampler delegate as the argument.
The delegate is used to make sampling decisions for ROOT spans.

The behavior of `ConsistentParentBased` caters to the case where a non-probabilistic sampler was used to sample the parent span.

Upon invocation of its `GetSamplingIntent` function, the sampler checks if there's a valid parent span context. If there isn't, the sampler MUST return the result of calling `GetSamplingIntent` on the delegate.

Otherwise, the sampler attempts to extract the threshold value from the parent trace state.
The sampler MUST return a `SamplingIntent` as follows.

If the parent trace state has a valid threshold T:

- The resulting THRESHOLD value is T.
- The `IsAdjustedCountReliable` returns `true`.

If the parent trace state has no valid threshold, the sampler examines the `sampled` flag from the traceparent.

If the flag is set:

- The resulting THRESHOLD value is `00000000000000` (or equivalent).
- The `IsAdjustedCountReliable` returns `false`.

If the flag is not set:

- The resulting THRESHOLD value is `null` (or equivalent).
- The `IsAdjustedCountReliable` returns `false`.

In all cases with valid parent context:

- The `GetAttributes` function returns empty set.
- The `UpdateTraceState` function returns its argument, without any modifications.

### ConsistentAnyOf

`ConsistentAnyOf` is a composite sampler which takes a non-empty list of ComposableSamplers (delegates) as the argument. The intention is to make a positive sampling decision if __any of__ the delegates would make a positive decision.
Expand Down

0 comments on commit db169b3

Please sign in to comment.