Skip to content

Commit

Permalink
Split ALWAYS_PARENT based on default behavior if no parent
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed May 18, 2020
1 parent 18b2752 commit f3bcd45
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,44 @@ Description MUST NOT change over time and caller can cache the returned value.

### Built-in samplers

These are the default samplers implemented in the OpenTelemetry SDK:

* ALWAYS_ON
* This will be used as a default.
* Description MUST be `AlwaysOnSampler`.
* ALWAYS_OFF
* Description MUST be `AlwaysOffSampler`.
* ALWAYS_PARENT
* `Returns RECORD_AND_SAMPLED` if `SampledFlag` is set to true on parent
SpanContext and `NOT_RECORD` otherwise.
* Description MUST be `AlwaysParentSampler`.
* Probability
* The default behavior should be to trust the parent `SampledFlag`. However
#### AlwaysOn

* This will be used as a default.
* Returns `RECORD_AND_SAMPLED` always.
* Description MUST be `AlwaysOnSampler`.

#### AlwaysOff

* Returns `NOT_RECORD` always.
* Description MUST be `AlwaysOffSampler`.

#### Probability

* The default behavior should be to trust the parent `SampledFlag`. However
there should be configuration to change this.
* The default behavior is to apply the sampling probability only for Spans
* The default behavior is to apply the sampling probability only for Spans
that are root spans (no parent) and Spans with remote parent. However there
should be configuration to change this to "root spans only", or "all spans".
* Description MUST be `ProbabilitySampler{0.000100}`.

#### Probability Sampler algorithm
* Description MUST be `ProbabilitySampler{0.000100}`.

TODO: Add details about how the probability sampler is implemented as a function
of the `TraceID`.

#### RootOnly

* Is a composite sampler `RootOnly(delegateSampler)` which ensures that the `delegateSampler` is called only for root spans.
* If there is a parent:
* If parent's `SampledFlag` is set to `true` returns `RECORD_AND_SAMPLED`
* If parent's `SampledFlag` is set to `false` returns `NOT_RECORD`
* If no parent (root span) returns the result of the `delegateSampler`.
* Description MUST be `RootOnly{delegateSampler.getDescription()}`.

|Parent's `SampledFlag`|`RootOnly(delegateSampler)`
|--|--|
|`true`|`RECORD_AND_SAMPLED`|
|`false`|`NOT_RECORD`|
|no parent(root spans)|Result of `delegateSampler()`|

## Tracer Creation

New `Tracer` instances are always created through a `TracerProvider` (see
Expand Down

0 comments on commit f3bcd45

Please sign in to comment.