Skip to content
Open
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
12 changes: 3 additions & 9 deletions sentry_sdk/integrations/boto3/_instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,16 @@ def _start_client_span(
with capture_internal_exceptions():
attributes.update(_get_client_attributes(ctx))

# `sentry.op` and `sentry.origin` are set to generic defaults;
# a service extension can override them with `get_span_op()` and `get_span_origin()`.
# `sentry.op` is set to a generic default, which a service extension can override
# with `get_span_op()`.
span_op = OP.HTTP_CLIENT
span_origin = ORIGIN

if service_ext is not None:
with capture_internal_exceptions():
service_op = service_ext.get_span_op(ctx)
if service_op is not None:
span_op = service_op

with capture_internal_exceptions():
service_origin = service_ext.get_span_origin(ctx)
if service_origin is not None:
span_origin = service_origin

with capture_internal_exceptions():
attributes.update(service_ext.get_request_attributes(ctx))

Expand All @@ -191,7 +185,7 @@ def _start_client_span(
attributes.update(
{
SPANDATA.SENTRY_OP: span_op,
SPANDATA.SENTRY_ORIGIN: span_origin,
SPANDATA.SENTRY_ORIGIN: ORIGIN,
}
)
return sentry_sdk.start_span(
Expand Down
4 changes: 0 additions & 4 deletions sentry_sdk/integrations/boto3/_services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ def get_span_op(self, ctx: "AwsCallContext") -> "Optional[str]":
"""Return an optional `sentry.op` override, or `None` to keep the default."""
return None

def get_span_origin(self, ctx: "AwsCallContext") -> "Optional[str]":
"""Return an optional `sentry.origin` override, or `None` to keep the default."""
return None

def get_request_attributes(self, ctx: "AwsCallContext") -> "Attributes":
"""Return request attributes to add before the AWS request is made."""
return {}
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/boto3/consts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IDENTIFIER = "boto3"
ORIGIN = f"auto.http.{IDENTIFIER}"
ORIGIN = f"auto.aws.{IDENTIFIER}"
CLOUD_PROVIDER = "aws"

# value is used by `rpc.system` (deprecated in OTel, but we still support it for now) and `rpc.system.name`
Expand Down
6 changes: 1 addition & 5 deletions tests/integrations/boto3/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,6 @@ class TestServiceExtension(_ServiceExtension):
def get_span_op(self, ctx):
return "aws.test"

def get_span_origin(self, ctx):
return "auto.aws.test"

def get_request_attributes(self, ctx):
return {
"aws.test.request": ctx.params["Key"],
Expand Down Expand Up @@ -476,7 +473,6 @@ def get_response_attributes(self, ctx, response):
spans_by_op = _capture_boto3_spans_by_op(
lambda: client.head_object(**api_params),
capture_items,
expected_origin="auto.aws.test",
)

spans = spans_by_op.get("aws.test", [])
Expand All @@ -486,7 +482,7 @@ def get_response_attributes(self, ctx, response):
assert span["name"] == "S3.HeadObject"
assert span.get("end_timestamp") is not None
assert attributes[SPANDATA.SENTRY_OP] == "aws.test"
assert attributes[SPANDATA.SENTRY_ORIGIN] == "auto.aws.test"
assert attributes[SPANDATA.SENTRY_ORIGIN] == "auto.aws.boto3"
assert attributes[SPANDATA.SENTRY_KIND] == "producer"
assert attributes[SPANDATA.CLOUD_PROVIDER] == CLOUD_PROVIDER
assert attributes[SPANDATA.RPC_SYSTEM_NAME] == AWS_RPC_SYSTEM_NAME
Expand Down
Loading