Skip to content

Commit 8754c5e

Browse files
committed
some things
1 parent 1b118cf commit 8754c5e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

sentry_sdk/integrations/opentelemetry/sampler.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ def get_parent_sample_rand(parent_context, trace_id):
9797

9898
def dropped_result(parent_span_context, attributes, sample_rate=None, sample_rand=None):
9999
# type: (SpanContext, Attributes, Optional[float], Optional[Decimal]) -> SamplingResult
100+
"""
101+
React to a span getting unsampled and return a DROP SamplingResult.
102+
103+
Update the trace_state with the effective sampled, sample_rate and sample_rand,
104+
record that we dropped the event for client report purposes, and return
105+
an OTel SamplingResult with Decision.DROP.
106+
"""
100107
# these will only be added the first time in a root span sampling decision
101108
# if sample_rate or sample_rand is provided, they'll be updated in trace state
102109
trace_state = parent_span_context.trace_state
@@ -138,6 +145,12 @@ def dropped_result(parent_span_context, attributes, sample_rate=None, sample_ran
138145

139146
def sampled_result(span_context, attributes, sample_rate=None, sample_rand=None):
140147
# type: (SpanContext, Attributes, Optional[float], Optional[Decimal]) -> SamplingResult
148+
"""
149+
React to a span being sampled and return a sampled SamplingResult.
150+
151+
Update the trace_state with the effective sampled, sample_rate and sample_rand,
152+
and return an OTel SamplingResult with Decision.RECORD_AND_SAMPLE.
153+
"""
141154
# these will only be added the first time in a root span sampling decision
142155
# if sample_rate or sample_rand is provided, they'll be updated in trace state
143156
trace_state = span_context.trace_state

sentry_sdk/tracing_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def _fill_sample_rand(self):
468468
sample_rand = Decimal(sentry_baggage["sample_rand"])
469469
except Exception:
470470
logger.debug(
471-
f"Failed to convert incoming sample_rand to int: {sample_rand}"
471+
f"Failed to convert incoming sample_rand to Decimal: {sample_rand}"
472472
)
473473

474474
if sample_rand is not None and 0 <= sample_rand < 1:

0 commit comments

Comments
 (0)