You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specification/trace/sdk.md
+32-17Lines changed: 32 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,29 +101,44 @@ Description MUST NOT change over time and caller can cache the returned value.
101
101
102
102
### Built-in samplers
103
103
104
-
These are the default samplers implemented in the OpenTelemetry SDK:
105
-
106
-
* ALWAYS_ON
107
-
* This will be used as a default.
108
-
* Description MUST be `AlwaysOnSampler`.
109
-
* ALWAYS_OFF
110
-
* Description MUST be `AlwaysOffSampler`.
111
-
* ALWAYS_PARENT
112
-
*`Returns RECORD_AND_SAMPLED` if `SampledFlag` is set to true on parent
113
-
SpanContext and `NOT_RECORD` otherwise.
114
-
* Description MUST be `AlwaysParentSampler`.
115
-
* Probability
116
-
* The default behavior should be to trust the parent `SampledFlag`. However
104
+
#### AlwaysOn
105
+
106
+
* This is the default sampler.
107
+
* Returns `RECORD_AND_SAMPLED` always.
108
+
* Description MUST be `AlwaysOnSampler`.
109
+
110
+
#### AlwaysOff
111
+
112
+
* Returns `NOT_RECORD` always.
113
+
* Description MUST be `AlwaysOffSampler`.
114
+
115
+
#### Probability
116
+
117
+
* The default behavior should be to trust the parent `SampledFlag`. However
117
118
there should be configuration to change this.
118
-
* The default behavior is to apply the sampling probability only for Spans
119
+
* The default behavior is to apply the sampling probability only for Spans
119
120
that are root spans (no parent) and Spans with remote parent. However there
120
121
should be configuration to change this to "root spans only", or "all spans".
121
-
* Description MUST be `ProbabilitySampler{0.000100}`.
122
-
123
-
#### Probability Sampler algorithm
122
+
* Description MUST be `ProbabilitySampler{0.000100}`.
124
123
125
124
TODO: Add details about how the probability sampler is implemented as a function
126
125
of the `TraceID`.
126
+
TODO: Split out the parent handling.
127
+
128
+
#### ParentOrElse
129
+
130
+
* This is a composite sampler. `ParentOrElse(delegateSampler)` either respects the parent span's sampling decision or delegates to `delegateSampler` for root spans.
131
+
* If parent exists:
132
+
* If parent's `SampledFlag` is set to `true` returns `RECORD_AND_SAMPLED`
133
+
* If parent's `SampledFlag` is set to `false` returns `NOT_RECORD`
134
+
* If no parent (root span) exists returns the result of the `delegateSampler`.
135
+
* Description MUST be `ParentOrElse{delegateSampler.getDescription()}`.
136
+
137
+
|Parent|`ParentOrElse(delegateSampler)`
138
+
|--|--|
139
+
|Exists and `SampledFlag` is `true`|`RECORD_AND_SAMPLED`|
140
+
|Exists and `SampledFlag` is `false`|`NOT_RECORD`|
141
+
|No parent(root spans)|Result of `delegateSampler()`|
0 commit comments