Skip to content

Commit bf40659

Browse files
committed
fix: sync span_kind with spec
1 parent 8f68412 commit bf40659

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def _enrich_send_span(
253253
span.set_attribute(messaging_attributes.MESSAGING_OPERATION_NAME, "send")
254254
span.set_attribute(
255255
messaging_attributes.MESSAGING_OPERATION_TYPE,
256-
messaging_attributes.MessagingOperationTypeValues.PUBLISH.value,
256+
messaging_attributes.MessagingOperationTypeValues.SEND.value,
257257
)
258258

259259

@@ -444,7 +444,7 @@ async def _create_consumer_span(
444444
with tracer.start_as_current_span(
445445
span_name,
446446
context=extracted_context,
447-
kind=trace.SpanKind.CONSUMER,
447+
kind=trace.SpanKind.CLIENT,
448448
) as span:
449449
new_context = trace.set_span_in_context(span, extracted_context)
450450
token = context.attach(new_context)

instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_instrumentation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async def test_getone(self) -> None:
158158
expected_spans = [
159159
{
160160
"name": "topic_1 receive",
161-
"kind": SpanKind.CONSUMER,
161+
"kind": SpanKind.CLIENT,
162162
"attributes": {
163163
messaging_attributes.MESSAGING_SYSTEM: messaging_attributes.MessagingSystemValues.KAFKA.value,
164164
server_attributes.SERVER_ADDRESS: "localhost",
@@ -175,7 +175,7 @@ async def test_getone(self) -> None:
175175
},
176176
{
177177
"name": "topic_2 receive",
178-
"kind": SpanKind.CONSUMER,
178+
"kind": SpanKind.CLIENT,
179179
"attributes": {
180180
messaging_attributes.MESSAGING_SYSTEM: messaging_attributes.MessagingSystemValues.KAFKA.value,
181181
server_attributes.SERVER_ADDRESS: "localhost",
@@ -293,7 +293,7 @@ async def test_getmany(self) -> None:
293293
expected_spans = [
294294
{
295295
"name": "topic_1 receive",
296-
"kind": SpanKind.CONSUMER,
296+
"kind": SpanKind.CLIENT,
297297
"attributes": {
298298
messaging_attributes.MESSAGING_SYSTEM: messaging_attributes.MessagingSystemValues.KAFKA.value,
299299
server_attributes.SERVER_ADDRESS: "localhost",
@@ -325,7 +325,7 @@ async def test_getmany(self) -> None:
325325
},
326326
{
327327
"name": "topic_2 receive",
328-
"kind": SpanKind.CONSUMER,
328+
"kind": SpanKind.CLIENT,
329329
"attributes": {
330330
messaging_attributes.MESSAGING_SYSTEM: messaging_attributes.MessagingSystemValues.KAFKA.value,
331331
server_attributes.SERVER_ADDRESS: "localhost",

instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ async def test_create_consumer_span(
347347
tracer.start_as_current_span.assert_called_once_with(
348348
expected_span_name,
349349
context=extracted_context,
350-
kind=SpanKind.CONSUMER,
350+
kind=SpanKind.CLIENT,
351351
)
352352
span = tracer.start_as_current_span.return_value.__enter__()
353353
set_span_in_context.assert_called_once_with(span, extracted_context)

0 commit comments

Comments
 (0)