Skip to content

Commit 774ea06

Browse files
ref(boto3): Rename span origin to auto.aws.boto3 (#8034)
### Description Rename the boto3 span origin from `auto.http.boto3` to `auto.aws.boto3`, for every boto3 span including the streamed response body child, and removes the unused `get_span_origin()` method from `_ServiceExtension`. ### Why 1. `auto.http.boto3` describes the underlying transport/integration used; boto3 spans are AWS API calls, and (in the future) the ops will be changed from `http.client` => `rpc`, `db`, `queue.*`, `object.*`, so it doesn't really fit anymore. 2. JS does the same and uses `auto.aws.aws_sdk`. ### Other option The other option is to use `auto.rpc.boto3` as the default origin (since `aws` isn't technically part of the categories, even though JS uses it https://develop.sentry.dev/sdk/telemetry/traces/trace-origin/) and override it with the span's op for different services: - `db` => `auto.db.boto3` - `queue.*` => `auto.queue.boto3` - `object.* ` => `auto.object.boto3` - streamed body child has op `http.client.stream` => `auto.http.boto3`
1 parent 6c430fb commit 774ea06

5 files changed

Lines changed: 6 additions & 20 deletions

File tree

‎MIGRATION_GUIDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
4646
- The `RustTracingIntegration` no longer includes the values of tracing fields if `send_default_pii` is enabled. Pass `include_tracing_fields=True` to the integration to include them.
4747
- Whether the Dramatiq integration attaches message bodies to events is now controlled by `data_collection`'s `queues` setting instead of `http_bodies`.
4848
- The Celery integration no longer sets the status of task spans to error when a task raises a control flow exception (`Retry`, `Ignore`, or `Reject`).
49-
- The boto3 integration now names spans `<ServiceID>.<Operation>` (for example, `S3.GetObject` or `DynamoDB.GetItem`), following OpenTelemetry semantic conventions. Previously, spans were named `aws.<service-id>.<Operation>` (for example, `aws.s3.GetObject`). Update any alerts, dashboards, or `ignore_spans` rules that match on the old names.
49+
- The boto3 integration now names spans `<ServiceID>.<Operation>` (for example, `S3.GetObject` or `DynamoDB.GetItem`), following OpenTelemetry semantic conventions. Previously, spans were named `aws.<service-id>.<Operation>` (for example, `aws.s3.GetObject`). Its spans, including the span for reading a streamed response body, now also have the origin `auto.aws.boto3` instead of `auto.http.boto3`. Update any alerts, dashboards, or `ignore_spans` rules that match on the old names or origin.
5050
- Enabling an AI agent integration (LangChain, OpenAI Agents, or Pydantic AI) no longer disables the OpenAI, Anthropic, and Google GenAI integrations. Instead, those integrations don't create chat spans for requests made from within an agent framework's chat span, but still create other spans, such as embedding spans. The LangChain integration no longer instruments embeddings directly; embedding spans are now created by the integration of the underlying client library.
5151
- Whether the MCP integration records tool arguments, tool results, and prompt contents is now controlled by `data_collection`'s new `mcp` setting (`{"inputs": bool, "outputs": bool}`, both `True` by default) instead of the `gen_ai` setting.
5252
- With `handled_tool_call_exceptions=True` (the default), the Pydantic AI integration now reports an error for every failed tool argument validation attempt, including retries. Previously, only one error was reported per tool call.

‎sentry_sdk/integrations/boto3/_instrumentation.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,16 @@ def _start_client_span(
167167
with capture_internal_exceptions():
168168
attributes.update(_get_client_attributes(ctx))
169169

170-
# `sentry.op` and `sentry.origin` are set to generic defaults;
171-
# a service extension can override them with `get_span_op()` and `get_span_origin()`.
170+
# `sentry.op` is set to a generic default, which a service extension can override
171+
# with `get_span_op()`.
172172
span_op = OP.RPC
173-
span_origin = ORIGIN
174173

175174
if service_ext is not None:
176175
with capture_internal_exceptions():
177176
service_op = service_ext.get_span_op(ctx)
178177
if service_op is not None:
179178
span_op = service_op
180179

181-
with capture_internal_exceptions():
182-
service_origin = service_ext.get_span_origin(ctx)
183-
if service_origin is not None:
184-
span_origin = service_origin
185-
186180
with capture_internal_exceptions():
187181
attributes.update(service_ext.get_request_attributes(ctx))
188182

@@ -191,7 +185,7 @@ def _start_client_span(
191185
attributes.update(
192186
{
193187
SPANDATA.SENTRY_OP: span_op,
194-
SPANDATA.SENTRY_ORIGIN: span_origin,
188+
SPANDATA.SENTRY_ORIGIN: ORIGIN,
195189
}
196190
)
197191
return sentry_sdk.start_span(

‎sentry_sdk/integrations/boto3/_services/base.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ def get_span_op(self, ctx: "AwsCallContext") -> "Optional[str]":
2121
"""Return an optional `sentry.op` override, or `None` to keep the default."""
2222
return None
2323

24-
def get_span_origin(self, ctx: "AwsCallContext") -> "Optional[str]":
25-
"""Return an optional `sentry.origin` override, or `None` to keep the default."""
26-
return None
27-
2824
def get_request_attributes(self, ctx: "AwsCallContext") -> "Attributes":
2925
"""Return request attributes to add before the AWS request is made."""
3026
return {}

‎sentry_sdk/integrations/boto3/consts.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
IDENTIFIER = "boto3"
2-
ORIGIN = f"auto.http.{IDENTIFIER}"
2+
ORIGIN = f"auto.aws.{IDENTIFIER}"
33
CLOUD_PROVIDER = "aws"
44

55
# value is used by `rpc.system` (deprecated in OTel, but we still support it for now) and `rpc.system.name`

‎tests/integrations/boto3/test_client.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,6 @@ class TestServiceExtension(_ServiceExtension):
442442
def get_span_op(self, ctx):
443443
return "aws.test"
444444

445-
def get_span_origin(self, ctx):
446-
return "auto.aws.test"
447-
448445
def get_request_attributes(self, ctx):
449446
return {
450447
"aws.test.request": ctx.params["Key"],
@@ -476,7 +473,6 @@ def get_response_attributes(self, ctx, response):
476473
spans_by_op = _capture_boto3_spans_by_op(
477474
lambda: client.head_object(**api_params),
478475
capture_items,
479-
expected_origin="auto.aws.test",
480476
)
481477

482478
spans = spans_by_op.get("aws.test", [])
@@ -486,7 +482,7 @@ def get_response_attributes(self, ctx, response):
486482
assert span["name"] == "S3.HeadObject"
487483
assert span.get("end_timestamp") is not None
488484
assert attributes[SPANDATA.SENTRY_OP] == "aws.test"
489-
assert attributes[SPANDATA.SENTRY_ORIGIN] == "auto.aws.test"
485+
assert attributes[SPANDATA.SENTRY_ORIGIN] == "auto.aws.boto3"
490486
assert attributes[SPANDATA.SENTRY_KIND] == "producer"
491487
assert attributes[SPANDATA.CLOUD_PROVIDER] == CLOUD_PROVIDER
492488
assert attributes[SPANDATA.RPC_SYSTEM_NAME] == AWS_RPC_SYSTEM_NAME

0 commit comments

Comments
 (0)