diff --git a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/sns.py b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/sns.py index 7849daa286..9536133f5c 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/sns.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/sns.py @@ -81,6 +81,8 @@ def extract_attributes( ] = MessagingDestinationKindValues.TOPIC.value attributes[SpanAttributes.MESSAGING_DESTINATION] = destination_name + # TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when opentelemetry-semantic-conventions 0.42b0 is released + attributes["messaging.destination.name"] = cls._extract_input_arn(call_context) call_context.span_name = ( f"{'phone_number' if is_phone_number else destination_name} send" ) diff --git a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_sns.py b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_sns.py index 33f2531027..cf676619e6 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_sns.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_sns.py @@ -118,6 +118,12 @@ def _test_publish_to_arn(self, arg_name: str): self.topic_name, span.attributes[SpanAttributes.MESSAGING_DESTINATION], ) + self.assertEqual( + target_arn, + # TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when + # opentelemetry-semantic-conventions 0.42b0 is released + span.attributes["messaging.destination.name"] + ) @mock_sns def test_publish_to_phone_number(self): @@ -184,6 +190,12 @@ def test_publish_batch_to_topic(self): self.topic_name, span.attributes[SpanAttributes.MESSAGING_DESTINATION], ) + self.assertEqual( + topic_arn, + # TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when + # opentelemetry-semantic-conventions 0.42b0 is released + span.attributes["messaging.destination.name"] + ) self.assert_injected_span(message1_attrs, span) self.assert_injected_span(message2_attrs, span)