mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-31 22:23:12 +08:00
Align sampling specs in SDK (#1034)
This commit is contained in:
@ -247,7 +247,7 @@ def _get_sampling_rate(span):
|
|||||||
return (
|
return (
|
||||||
span.sampler.rate
|
span.sampler.rate
|
||||||
if ctx.trace_flags.sampled
|
if ctx.trace_flags.sampled
|
||||||
and isinstance(span.sampler, sampling.ProbabilitySampler)
|
and isinstance(span.sampler, sampling.TraceIdRatioBased)
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ class TestDatadogSpanExporter(unittest.TestCase):
|
|||||||
is_remote=False,
|
is_remote=False,
|
||||||
trace_flags=trace_api.TraceFlags(trace_api.TraceFlags.SAMPLED),
|
trace_flags=trace_api.TraceFlags(trace_api.TraceFlags.SAMPLED),
|
||||||
)
|
)
|
||||||
sampler = sampling.ProbabilitySampler(0.5)
|
sampler = sampling.TraceIdRatioBased(0.5)
|
||||||
|
|
||||||
span = trace.Span(
|
span = trace.Span(
|
||||||
name="sampled", context=context, parent=None, sampler=sampler
|
name="sampled", context=context, parent=None, sampler=sampler
|
||||||
|
Reference in New Issue
Block a user