Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/instana/propagators/base_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ def __determine_span_context(
correlation = True

(
ctx_trace_id,
ctx_span_id,
ctx_level,
ctx_synthetic,
ctx_trace_parent,
Expand All @@ -192,9 +190,11 @@ def __determine_span_context(
ctx_correlation_id,
ctx_traceparent,
ctx_tracestate,
) = [None] * 11
) = [None] * 9

ctx_level = self._get_ctx_level(level)
ctx_trace_id = trace_id
ctx_span_id = span_id

if (
trace_id
Expand All @@ -204,8 +204,6 @@ def __determine_span_context(
):
# ctx.trace_id = trace_id[-16:] # only the last 16 chars
# ctx.span_id = span_id[-16:] # only the last 16 chars
ctx_trace_id = trace_id
ctx_span_id = span_id
ctx_synthetic = synthetic

# if len(trace_id) > 16:
Expand Down
6 changes: 3 additions & 3 deletions src/instana/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ def start_span(
) -> InstanaSpan:
parent_context = span_context if span_context else get_current_span().get_span_context()

if parent_context is not None and not isinstance(parent_context, SpanContext):
if parent_context and not isinstance(parent_context, SpanContext):
raise TypeError("parent_context must be an Instana SpanContext or None.")

if parent_context is not None and not parent_context.is_valid:
if parent_context and not parent_context.is_valid and not parent_context.suppression:
# We probably have an INVALID_SPAN_CONTEXT.
parent_context = None

Expand Down Expand Up @@ -213,7 +213,7 @@ def _add_stack(self, span: InstanaSpan, limit: Optional[int] = 30) -> None:
def _create_span_context(self, parent_context: SpanContext) -> SpanContext:
"""Creates a new SpanContext based on the given parent context."""

if parent_context is not None and parent_context.trace_id is not None:
if parent_context and parent_context.is_valid:
trace_id = parent_context.trace_id
span_id = generate_id()
trace_flags = parent_context.trace_flags
Expand Down
4 changes: 1 addition & 3 deletions tests/frameworks/test_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def test_get_request_with_query_params(self) -> None:
# We should NOT have a path template for this route
assert wsgi_span.data["http"]["path_tpl"] is None

@unittest.skip("Suppression is not yet handled")
def test_get_request_with_suppression(self) -> None:
headers = {'X-INSTANA-L':'0'}
response = self.http.urlopen('GET', testenv["flask_server"] + '/', headers=headers)
Expand All @@ -213,7 +212,7 @@ def test_get_request_with_suppression(self) -> None:
# Assert that there are no spans in the recorded list
assert spans == []

@unittest.skip("Suppression is not yet handled")
@unittest.skip("Handled when type of trace and span ids are modified to str")
def test_get_request_with_suppression_and_w3c(self) -> None:
headers = {
'X-INSTANA-L':'0',
Expand All @@ -239,7 +238,6 @@ def test_get_request_with_suppression_and_w3c(self) -> None:
# Assert that there are no spans in the recorded list
assert spans == []

@unittest.skip("Synthetic requests are not yet handled")
def test_synthetic_request(self) -> None:
headers = {
'X-INSTANA-SYNTHETIC': '1'
Expand Down
1 change: 0 additions & 1 deletion tests/frameworks/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def test_get_request(self) -> None:
assert wsgi_span.data["http"]["error"] is None
assert wsgi_span.stack is None

@pytest.mark.skip("Suppression is not yet handled")
def test_synthetic_request(self) -> None:
headers = {
'X-INSTANA-SYNTHETIC': '1'
Expand Down