Skip to content

Commit 0d23386

Browse files
authored
Merge branch 'main' into feature/asyncio-instrumentation
2 parents fe89033 + 657d502 commit 0d23386

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
([#1919](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1943))
1313
- `opentelemetry-instrumentation-aiohttp-server` Add instrumentor and auto instrumentation support for aiohttp-server
1414
([#1800](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1800))
15+
- `opentelemetry-instrumentation-botocore` Include SNS topic ARN as a span attribute with name `messaging.destination.name` to uniquely identify the SNS topic
16+
([#1995](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1995))
1517
- `opentelemetry-instrumentation-system-metrics` Add support for collecting process metrics
1618
([#1948](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1948))
1719

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/sns.py

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def extract_attributes(
8181
] = MessagingDestinationKindValues.TOPIC.value
8282
attributes[SpanAttributes.MESSAGING_DESTINATION] = destination_name
8383

84+
# TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when opentelemetry-semantic-conventions 0.42b0 is released
85+
attributes["messaging.destination.name"] = cls._extract_input_arn(call_context)
8486
call_context.span_name = (
8587
f"{'phone_number' if is_phone_number else destination_name} send"
8688
)

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_sns.py

+12
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ def _test_publish_to_arn(self, arg_name: str):
118118
self.topic_name,
119119
span.attributes[SpanAttributes.MESSAGING_DESTINATION],
120120
)
121+
self.assertEqual(
122+
target_arn,
123+
# TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when
124+
# opentelemetry-semantic-conventions 0.42b0 is released
125+
span.attributes["messaging.destination.name"]
126+
)
121127

122128
@mock_sns
123129
def test_publish_to_phone_number(self):
@@ -184,6 +190,12 @@ def test_publish_batch_to_topic(self):
184190
self.topic_name,
185191
span.attributes[SpanAttributes.MESSAGING_DESTINATION],
186192
)
193+
self.assertEqual(
194+
topic_arn,
195+
# TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when
196+
# opentelemetry-semantic-conventions 0.42b0 is released
197+
span.attributes["messaging.destination.name"]
198+
)
187199

188200
self.assert_injected_span(message1_attrs, span)
189201
self.assert_injected_span(message2_attrs, span)

0 commit comments

Comments
 (0)