Move samplers to SDK package (#1023)
This commit is contained in:
parent
3e373c1acc
commit
02d48caf17
|
|
@ -21,6 +21,7 @@ from ddtrace.internal.writer import AgentWriter
|
|||
from ddtrace.span import Span as DatadogSpan
|
||||
|
||||
import opentelemetry.trace as trace_api
|
||||
from opentelemetry.sdk.trace import sampling
|
||||
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
|
||||
from opentelemetry.trace.status import StatusCanonicalCode
|
||||
|
||||
|
|
@ -246,7 +247,7 @@ def _get_sampling_rate(span):
|
|||
return (
|
||||
span.sampler.rate
|
||||
if ctx.trace_flags.sampled
|
||||
and isinstance(span.sampler, trace_api.sampling.ProbabilitySampler)
|
||||
and isinstance(span.sampler, sampling.ProbabilitySampler)
|
||||
else None
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from ddtrace.internal.writer import AgentWriter
|
|||
from opentelemetry import trace as trace_api
|
||||
from opentelemetry.exporter import datadog
|
||||
from opentelemetry.sdk import trace
|
||||
from opentelemetry.sdk.trace import sampling
|
||||
from opentelemetry.sdk.util.instrumentation import InstrumentationInfo
|
||||
|
||||
|
||||
|
|
@ -497,7 +498,7 @@ class TestDatadogSpanExporter(unittest.TestCase):
|
|||
is_remote=False,
|
||||
trace_flags=trace_api.TraceFlags(trace_api.TraceFlags.SAMPLED),
|
||||
)
|
||||
sampler = trace_api.sampling.ProbabilitySampler(0.5)
|
||||
sampler = sampling.ProbabilitySampler(0.5)
|
||||
|
||||
span = trace.Span(
|
||||
name="sampled", context=context, parent=None, sampler=sampler
|
||||
|
|
|
|||
Loading…
Reference in New Issue