Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ class SPANDATA:
Example: "10.1.2.80"
"""

CLOUD_PROVIDER = "cloud.provider"
"""
Name of the cloud provider.

Example: "aws"
"""

CLOUD_REGION = "cloud.region"
"""
The geographical region the resource is running.
Expand Down
2 changes: 2 additions & 0 deletions sentry_sdk/integrations/boto3/_instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from sentry_sdk.integrations import DidNotEnable
from sentry_sdk.integrations.boto3.consts import (
AWS_RPC_SYSTEM_NAME,
CLOUD_PROVIDER,
DEFAULT_PORTS,
IDENTIFIER,
ORIGIN,
Expand Down Expand Up @@ -156,6 +157,7 @@ def _start_client_span(
service_name = ctx.service_id or "unknown"
span_name = f"{service_name}.{ctx.operation_name}"
attributes: "Attributes" = {
SPANDATA.CLOUD_PROVIDER: CLOUD_PROVIDER,
SPANDATA.RPC_METHOD: ctx.operation_name,
SPANDATA.RPC_SYSTEM_NAME: AWS_RPC_SYSTEM_NAME,
# all client call spans are by default "client" spans.
Expand Down
1 change: 1 addition & 0 deletions sentry_sdk/integrations/boto3/consts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
IDENTIFIER = "boto3"
ORIGIN = f"auto.http.{IDENTIFIER}"
CLOUD_PROVIDER = "aws"

# value is used by `rpc.system` (deprecated in OTel, but we still support it for now) and `rpc.system.name`
# https://opentelemetry.io/docs/specs/semconv/cloud-providers/aws-sdk/#aws-sdk-spans
Expand Down
8 changes: 7 additions & 1 deletion tests/integrations/boto3/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
from sentry_sdk.integrations.boto3 import Boto3Integration
from sentry_sdk.integrations.boto3._services.base import _ServiceExtension
from sentry_sdk.integrations.boto3._services.registry import _SERVICE_EXTENSIONS
from sentry_sdk.integrations.boto3.consts import AWS_RPC_SYSTEM_NAME, ORIGIN
from sentry_sdk.integrations.boto3.consts import (
AWS_RPC_SYSTEM_NAME,
CLOUD_PROVIDER,
ORIGIN,
)
from sentry_sdk.integrations.stdlib import StdlibIntegration
from sentry_sdk.traces import Span
from tests.integrations.boto3.aws_mock import Body, MockResponse
Expand Down Expand Up @@ -432,6 +436,7 @@ def test_client_call_has_common_attributes(
assert attributes[SPANDATA.RPC_SYSTEM_NAME] == AWS_RPC_SYSTEM_NAME
assert attributes[SPANDATA.SENTRY_KIND] == "client"
assert attributes[SPANDATA.CLOUD_REGION] == "eu-north-1"
assert attributes[SPANDATA.CLOUD_PROVIDER] == CLOUD_PROVIDER
assert attributes[SPANDATA.SERVER_ADDRESS] == server_address
assert attributes[SPANDATA.SERVER_PORT] == server_port
assert attributes[SPANDATA.HTTP_STATUS_CODE] == 200
Expand All @@ -452,6 +457,7 @@ def test_client_call_attributes_are_available_at_span_creation(
ignore_spans=[
{
"attributes": {
SPANDATA.CLOUD_PROVIDER: CLOUD_PROVIDER,
SPANDATA.RPC_METHOD: "HeadObject",
SPANDATA.RPC_SERVICE: "S3",
SPANDATA.RPC_SYSTEM_NAME: AWS_RPC_SYSTEM_NAME,
Expand Down
Loading