Skip to content

Commit dd4c8fb

Browse files
authored
Merge branch 'main' into richconsole-spanattributes
2 parents 086ee5b + 4b9b949 commit dd4c8fb

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212
## Unreleased
1313

14+
### Breaking changes
15+
16+
- `opentelemetry-instrumentation-botocore` Use `cloud.region` instead of `aws.region` span attribute as per semantic conventions.
17+
([#3474](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3474))
18+
19+
1420
## Version 1.33.0/0.54b0 (2025-05-09)
1521

1622
### Added

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def response_hook(span, service_name, operation_name, result):
109109
)
110110
from opentelemetry.metrics import Instrument, Meter, get_meter
111111
from opentelemetry.propagators.aws.aws_xray_propagator import AwsXRayPropagator
112+
from opentelemetry.semconv._incubating.attributes.cloud_attributes import (
113+
CLOUD_REGION,
114+
)
112115
from opentelemetry.semconv.trace import SpanAttributes
113116
from opentelemetry.trace import get_tracer
114117
from opentelemetry.trace.span import Span
@@ -276,8 +279,7 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
276279
SpanAttributes.RPC_SYSTEM: "aws-api",
277280
SpanAttributes.RPC_SERVICE: call_context.service_id,
278281
SpanAttributes.RPC_METHOD: call_context.operation,
279-
# TODO: update when semantic conventions exist
280-
"aws.region": call_context.region,
282+
CLOUD_REGION: call_context.region,
281283
**get_server_attributes(call_context.endpoint_url),
282284
}
283285

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
)
2828
from opentelemetry.propagate import get_global_textmap, set_global_textmap
2929
from opentelemetry.propagators.aws.aws_xray_propagator import TRACE_HEADER_KEY
30+
from opentelemetry.semconv._incubating.attributes.cloud_attributes import (
31+
CLOUD_REGION,
32+
)
3033
from opentelemetry.semconv.trace import SpanAttributes
3134
from opentelemetry.test.mock_textmap import MockTextMapPropagator
3235
from opentelemetry.test.test_base import TestBase
@@ -61,7 +64,7 @@ def _default_span_attributes(self, service: str, operation: str):
6164
SpanAttributes.RPC_SYSTEM: "aws-api",
6265
SpanAttributes.RPC_SERVICE: service,
6366
SpanAttributes.RPC_METHOD: operation,
64-
"aws.region": self.region,
67+
CLOUD_REGION: self.region,
6568
"retry_attempts": 0,
6669
SpanAttributes.HTTP_STATUS_CODE: 200,
6770
# Some services like IAM or STS have a global endpoint and exclude specified region.
@@ -527,7 +530,7 @@ def test_server_attributes(self):
527530
attributes={
528531
SpanAttributes.SERVER_ADDRESS: "iam.amazonaws.com",
529532
SpanAttributes.SERVER_PORT: 443,
530-
"aws.region": "aws-global",
533+
CLOUD_REGION: "aws-global",
531534
},
532535
)
533536

0 commit comments

Comments
 (0)