72
72
73
73
class Decision (enum .Enum ):
74
74
# IsRecording() == false, span will not be recorded and all events and attributes will be dropped.
75
- NOT_RECORD = 0
75
+ IGNORE = 0
76
76
# IsRecording() == true, but Sampled flag MUST NOT be set.
77
- RECORD = 1
77
+ RECORD_ONLY = 1
78
78
# IsRecording() == true AND Sampled flag` MUST be set.
79
- RECORD_AND_SAMPLED = 2
79
+ RECORD_AND_SAMPLE = 2
80
80
81
81
def is_recording (self ):
82
- return self in (Decision .RECORD , Decision .RECORD_AND_SAMPLED )
82
+ return self in (Decision .RECORD_ONLY , Decision .RECORD_AND_SAMPLE )
83
83
84
84
def is_sampled (self ):
85
- return self is Decision .RECORD_AND_SAMPLED
85
+ return self is Decision .RECORD_AND_SAMPLE
86
86
87
87
88
88
class SamplingResult :
@@ -140,12 +140,12 @@ def should_sample(
140
140
attributes : Attributes = None ,
141
141
links : Sequence ["Link" ] = (),
142
142
) -> "SamplingResult" :
143
- if self ._decision is Decision .NOT_RECORD :
143
+ if self ._decision is Decision .IGNORE :
144
144
return SamplingResult (self ._decision )
145
145
return SamplingResult (self ._decision , attributes )
146
146
147
147
def get_description (self ) -> str :
148
- if self ._decision is Decision .NOT_RECORD :
148
+ if self ._decision is Decision .IGNORE :
149
149
return "AlwaysOffSampler"
150
150
return "AlwaysOnSampler"
151
151
@@ -194,10 +194,10 @@ def should_sample(
194
194
attributes : Attributes = None , # TODO
195
195
links : Sequence ["Link" ] = (),
196
196
) -> "SamplingResult" :
197
- decision = Decision .NOT_RECORD
197
+ decision = Decision .IGNORE
198
198
if trace_id & self .TRACE_ID_LIMIT < self .bound :
199
- decision = Decision .RECORD_AND_SAMPLED
200
- if decision is Decision .NOT_RECORD :
199
+ decision = Decision .RECORD_AND_SAMPLE
200
+ if decision is Decision .IGNORE :
201
201
return SamplingResult (decision )
202
202
return SamplingResult (decision , attributes )
203
203
@@ -231,8 +231,8 @@ def should_sample(
231
231
not parent_context .is_valid
232
232
or not parent_context .trace_flags .sampled
233
233
):
234
- return SamplingResult (Decision .NOT_RECORD )
235
- return SamplingResult (Decision .RECORD_AND_SAMPLED , attributes )
234
+ return SamplingResult (Decision .IGNORE )
235
+ return SamplingResult (Decision .RECORD_AND_SAMPLE , attributes )
236
236
237
237
return self ._delegate .should_sample (
238
238
parent_context = parent_context ,
@@ -246,10 +246,10 @@ def get_description(self):
246
246
return "ParentBased{{{}}}" .format (self ._delegate .get_description ())
247
247
248
248
249
- ALWAYS_OFF = StaticSampler (Decision .NOT_RECORD )
249
+ ALWAYS_OFF = StaticSampler (Decision .IGNORE )
250
250
"""Sampler that never samples spans, regardless of the parent span's sampling decision."""
251
251
252
- ALWAYS_ON = StaticSampler (Decision .RECORD_AND_SAMPLED )
252
+ ALWAYS_ON = StaticSampler (Decision .RECORD_AND_SAMPLE )
253
253
"""Sampler that always samples spans, regardless of the parent span's sampling decision."""
254
254
255
255
DEFAULT_OFF = ParentBased (ALWAYS_OFF )
0 commit comments