Skip to content

Commit a68531a

Browse files
committed
refactor(tests): Adapt SDK spans to use the kind parameter
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
1 parent c35a45a commit a68531a

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

tests/span/test_span_sdk.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# (c) Copyright IBM Corp. 2024
22

33
from typing import Generator, Tuple
4-
54
import pytest
5+
from opentelemetry.trace import SpanKind
66

77
from instana.recorder import StanRecorder
88
from instana.span.sdk_span import SDKSpan
@@ -24,12 +24,11 @@ def test_sdkspan(
2424
span_name = "test-sdk-span"
2525
service_name = "test-sdk"
2626
attributes = {
27-
"span.kind": "entry",
2827
"arguments": "--quiet",
2928
"return": "True",
3029
}
3130
self.span = InstanaSpan(
32-
span_name, span_context, span_processor, attributes=attributes
31+
span_name, span_context, span_processor, attributes=attributes, kind=SpanKind.SERVER
3332
)
3433
sdk_span = SDKSpan(self.span, None, service_name)
3534

@@ -40,9 +39,9 @@ def test_sdkspan(
4039
"service": service_name,
4140
"sdk": {
4241
"name": span_name,
43-
"type": attributes["span.kind"],
42+
"type": "entry",
4443
"custom": {
45-
"attributes": attributes,
44+
"tags": attributes,
4645
},
4746
"arguments": attributes["arguments"],
4847
"return": attributes["return"],
@@ -81,19 +80,16 @@ def test_sdkspan_get_span_kind(
8180
span_kind: str,
8281
expected_result: Tuple[str, int],
8382
) -> None:
84-
attributes = {
85-
"span.kind": span_kind,
86-
}
8783
self.span = InstanaSpan(
88-
"test-sdk-span", span_context, span_processor, attributes=attributes
84+
"test-sdk-span", span_context, span_processor, kind=span_kind
8985
)
9086
sdk_span = SDKSpan(self.span, None, "test")
9187

9288
kind = sdk_span.get_span_kind(self.span)
9389

9490
assert expected_result == kind
9591

96-
def test_sdkspan_get_span_kind_with_no_attributes(
92+
def test_sdkspan_get_span_kind_default(
9793
self,
9894
span: InstanaSpan,
9995
) -> None:

0 commit comments

Comments
 (0)