Skip to content

Commit

Permalink
Fix the tests to use the updated semantic conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
P6rguVyrst committed Jul 13, 2024
1 parent 05f8b04 commit 7a34b9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
from opentelemetry.instrumentation.aio_pika.callback_decorator import (
CallbackDecorator,
)
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace import SpanKind, get_tracer
from opentelemetry.semconv._incubating.attributes import messaging_attributes as SpanAttributes
from opentelemetry.semconv._incubating.attributes import net_attributes as NetAttributes

from .consts import (
AIOPIKA_VERSION_INFO,
Expand All @@ -41,12 +42,12 @@
class TestInstrumentedQueueAioRmq7(TestCase):
EXPECTED_ATTRIBUTES = {
SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM,
SpanAttributes.MESSAGING_DESTINATION: EXCHANGE_NAME,
SpanAttributes.NET_PEER_NAME: SERVER_HOST,
SpanAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_DESTINATION_NAME: EXCHANGE_NAME,
NetAttributes.NET_PEER_NAME: SERVER_HOST,
NetAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_MESSAGE_ID: MESSAGE_ID,
SpanAttributes.MESSAGING_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_OPERATION: "receive",
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_OPERATION_TYPE: "receive",
}

def setUp(self):
Expand Down Expand Up @@ -81,12 +82,12 @@ def test_decorate_callback(self):
class TestInstrumentedQueueAioRmq8(TestCase):
EXPECTED_ATTRIBUTES = {
SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM,
SpanAttributes.MESSAGING_DESTINATION: EXCHANGE_NAME,
SpanAttributes.NET_PEER_NAME: SERVER_HOST,
SpanAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_DESTINATION_NAME: EXCHANGE_NAME,
NetAttributes.NET_PEER_NAME: SERVER_HOST,
NetAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_MESSAGE_ID: MESSAGE_ID,
SpanAttributes.MESSAGING_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_OPERATION: "receive",
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_OPERATION_TYPE: "receive",
}

def setUp(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
from opentelemetry.instrumentation.aio_pika.publish_decorator import (
PublishDecorator,
)
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace import SpanKind, get_tracer

from opentelemetry.semconv._incubating.attributes import messaging_attributes as SpanAttributes
from opentelemetry.semconv._incubating.attributes import net_attributes as NetAttributes
from .consts import (
AIOPIKA_VERSION_INFO,
CHANNEL_7,
Expand All @@ -45,12 +46,12 @@
class TestInstrumentedExchangeAioRmq7(TestCase):
EXPECTED_ATTRIBUTES = {
SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM,
SpanAttributes.MESSAGING_DESTINATION: f"{EXCHANGE_NAME},{ROUTING_KEY}",
SpanAttributes.NET_PEER_NAME: SERVER_HOST,
SpanAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_DESTINATION_NAME: f"{EXCHANGE_NAME},{ROUTING_KEY}", # TODO: FIXIT - split name & key
NetAttributes.NET_PEER_NAME: SERVER_HOST,
NetAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_MESSAGE_ID: MESSAGE_ID,
SpanAttributes.MESSAGING_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_TEMP_DESTINATION: True,
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_DESTINATION_TEMPORARY: True,
}

def setUp(self):
Expand Down Expand Up @@ -124,12 +125,12 @@ def test_publish_works_with_not_recording_span_robust(self):
class TestInstrumentedExchangeAioRmq8(TestCase):
EXPECTED_ATTRIBUTES = {
SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM,
SpanAttributes.MESSAGING_DESTINATION: f"{EXCHANGE_NAME},{ROUTING_KEY}",
SpanAttributes.NET_PEER_NAME: SERVER_HOST,
SpanAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_DESTINATION_NAME: f"{EXCHANGE_NAME},{ROUTING_KEY}", # TODO: fixit
NetAttributes.NET_PEER_NAME: SERVER_HOST,
NetAttributes.NET_PEER_PORT: SERVER_PORT,
SpanAttributes.MESSAGING_MESSAGE_ID: MESSAGE_ID,
SpanAttributes.MESSAGING_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_TEMP_DESTINATION: True,
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: CORRELATION_ID,
SpanAttributes.MESSAGING_DESTINATION_TEMPORARY: True,
}

def setUp(self):
Expand Down

0 comments on commit 7a34b9b

Please sign in to comment.