Skip to content

Commit

Permalink
Applying API changes to datadog propagator
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed May 24, 2020
1 parent 9708ca9 commit e7472e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from opentelemetry import trace
from opentelemetry.context import Context
from opentelemetry.trace.propagation import (
get_span_from_context,
get_current_span,
set_span_in_context,
)
from opentelemetry.trace.propagation.httptextformat import (
Expand Down Expand Up @@ -88,7 +88,7 @@ def inject(
carrier: HTTPTextFormatT,
context: typing.Optional[Context] = None,
) -> None:
span = get_span_from_context(context=context)
span = get_current_span(context)
sampled = (trace.TraceFlags.SAMPLED & span.context.trace_flags) != 0
set_in_carrier(
carrier, self.TRACE_ID_KEY, format_trace_id(span.context.trace_id),
Expand Down
12 changes: 6 additions & 6 deletions ext/opentelemetry-ext-datadog/tests/test_datadog_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from opentelemetry.ext.datadog import constants, propagator
from opentelemetry.sdk import trace
from opentelemetry.trace.propagation import (
get_span_from_context,
get_current_span,
set_span_in_context,
)

Expand All @@ -45,7 +45,7 @@ def test_malformed_headers(self):
"""Test with no Datadog headers"""
malformed_trace_id_key = FORMAT.TRACE_ID_KEY + "-x"
malformed_parent_id_key = FORMAT.PARENT_ID_KEY + "-x"
context = get_span_from_context(
context = get_current_span(
FORMAT.extract(
get_as_list,
{
Expand All @@ -66,7 +66,7 @@ def test_missing_trace_id(self):
}

ctx = FORMAT.extract(get_as_list, carrier)
span_context = get_span_from_context(ctx).get_context()
span_context = get_current_span(ctx).get_context()
self.assertEqual(span_context.trace_id, trace_api.INVALID_TRACE_ID)

def test_missing_parent_id(self):
Expand All @@ -76,12 +76,12 @@ def test_missing_parent_id(self):
}

ctx = FORMAT.extract(get_as_list, carrier)
span_context = get_span_from_context(ctx).get_context()
span_context = get_current_span(ctx).get_context()
self.assertEqual(span_context.span_id, trace_api.INVALID_SPAN_ID)

def test_context_propagation(self):
"""Test the propagation of Datadog headers."""
parent_context = get_span_from_context(
parent_context = get_current_span(
FORMAT.extract(
get_as_list,
{
Expand Down Expand Up @@ -138,7 +138,7 @@ def test_context_propagation(self):

def test_sampling_priority_auto_reject(self):
"""Test sampling priority rejected."""
parent_context = get_span_from_context(
parent_context = get_current_span(
FORMAT.extract(
get_as_list,
{
Expand Down

0 comments on commit e7472e7

Please sign in to comment.