Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3447](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3447))
- `opentelemetry-instrumentation-botocore` Capture server attributes for botocore API calls
([#3448](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3448))
- `opentelemetry-instrumentation-botocore` Use semantic convention attribute for cloud region for botocore API calls
([#3474](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3474))

## Version 1.32.0/0.53b0 (2025-04-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def response_hook(span, service_name, operation_name, result):
)
from opentelemetry.metrics import Instrument, Meter, get_meter
from opentelemetry.propagators.aws.aws_xray_propagator import AwsXRayPropagator
from opentelemetry.semconv._incubating.attributes.cloud_attributes import (
CLOUD_REGION,
)
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace import get_tracer
from opentelemetry.trace.span import Span
Expand Down Expand Up @@ -276,8 +279,7 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
SpanAttributes.RPC_SYSTEM: "aws-api",
SpanAttributes.RPC_SERVICE: call_context.service_id,
SpanAttributes.RPC_METHOD: call_context.operation,
# TODO: update when semantic conventions exist
"aws.region": call_context.region,
CLOUD_REGION: call_context.region,
**get_server_attributes(call_context.endpoint_url),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
)
from opentelemetry.propagate import get_global_textmap, set_global_textmap
from opentelemetry.propagators.aws.aws_xray_propagator import TRACE_HEADER_KEY
from opentelemetry.semconv._incubating.attributes.cloud_attributes import (
CLOUD_REGION,
)
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.test.mock_textmap import MockTextMapPropagator
from opentelemetry.test.test_base import TestBase
Expand Down Expand Up @@ -61,7 +64,7 @@ def _default_span_attributes(self, service: str, operation: str):
SpanAttributes.RPC_SYSTEM: "aws-api",
SpanAttributes.RPC_SERVICE: service,
SpanAttributes.RPC_METHOD: operation,
"aws.region": self.region,
CLOUD_REGION: self.region,
"retry_attempts": 0,
SpanAttributes.HTTP_STATUS_CODE: 200,
# Some services like IAM or STS have a global endpoint and exclude specified region.
Expand Down Expand Up @@ -527,7 +530,7 @@ def test_server_attributes(self):
attributes={
SpanAttributes.SERVER_ADDRESS: "iam.amazonaws.com",
SpanAttributes.SERVER_PORT: 443,
"aws.region": "aws-global",
CLOUD_REGION: "aws-global",
},
)

Expand Down