GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(boto3): Trace the complete botocore client-call lifecycle by pabloDeputter · Pull Request #7538 · getsentry/sentry-python

Conversation

@pabloDeputter

@pabloDeputter pabloDeputter commented Sep 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Description

Move boto3 span creation from individual HTTP request attempts to full botocore client-call lifecycle.

Previously, the client span was created from the botocore request-created event; since botocore creates a new AwsRequest event for every retry, these spans represent individual retries rather than the full event. Following OTel (https://opentelemetry.io/docs/specs/semconv/rpc/rpc-spans/#rpc-client-span) the span should cover the entire call lifecycle including all retries. Wrapping _make_api_call() covers all retries performed by botocore, including serialization, endpoint resolution, the final response or failures (https://github.com/boto/botocore/blob/develop/botocore/client.py:999).

  • patch BaseClient._make_api_call() so one span represents a single boto operation; this span is also kept active across every retry attempt.
  • request-created is kept for breadcrumbs, HTTP request attributes, and trace propagation.
  • client spans that fail will preserve the original exception.
  • responses that return a StreamingBody are kept open until body is consumed or closed.
  • fix the correct parent/child relationship between boto, HTTP, and streaming spans.

Issues

Resolves #7474

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pabloDeputter
pabloDeputter added this pull request to stack #7539 September 18, 2026 14:23
@github-actions

github-actions Bot commented Sep 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ 132487 passed | ⏭️ 7220 skipped | Total: 139707 | Pass Rate: 94.83% | Execution Time: 454m 48s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +3123
Passed Tests 📈 +3160
Failed Tests 📉 -60
Skipped Tests 📈 +23

➖ Removed Tests (60)

View removed tests
  • test_input_attributes_nonstreaming_chat[False-True-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-True-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-True-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat[False-False-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-True-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[True-False-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-True-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-True-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages1-expected_system_instructions1-expected_input_messages1]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages2-expected_system_instructions2-expected_input_messages2]
    • File: tests.integrations.mistral.test_mistral
  • test_input_attributes_nonstreaming_chat_async[False-False-False-messages3-expected_system_instructions3-expected_input_messages3]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[True-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat[False-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[True-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-True-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-True-False]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-False-True]
    • File: tests.integrations.mistral.test_mistral
  • test_output_attributes_nonstreaming_chat_async[False-False-False]
    • File: tests.integrations.mistral.test_mistral
  • test_cache_spans_templatetag[True]
    • File: tests.integrations.django.test_cache_module

All tests are passing successfully.

✅ Patch coverage is 95.51%. Project has 2551 uncovered lines.
✅ Project coverage is 90.35%. Comparing base (364f547) to head (2647da1).

Files with missing lines (3)
File Patch % Lines
sentry_sdk/integrations/boto3/_instrumentation.py 94.51% ⚠️ 5 Missing and 11 partials
sentry_sdk/integrations/boto3/_client.py 96.23% ⚠️ 2 Missing and 1 partials
sentry_sdk/integrations/boto3/_context.py 96.30% ⚠️ 1 Missing and 2 partials
Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
+ Coverage    90.31%    90.35%    +0.04%
==========================================
  Files          195       199        +4
  Lines        26261     26422      +161
  Branches      9798      9834       +36
==========================================
+ Hits         23714     23871      +157
- Misses        2547      2551        +4
- Partials      1485      1491        +6

Generated by Codecov Action

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 53a8717 to 4efce4b Compare September 18, 2026 15:06
@pabloDeputter
pabloDeputter removed this pull request from stack #7539 September 18, 2026 15:08
@pabloDeputter
pabloDeputter changed the base branch from pablo/refactor-boto3-integration to pablo/harden-boto3-streaming-body September 18, 2026 15:08
@pabloDeputter
pabloDeputter added this pull request to stack #7541 September 18, 2026 15:08
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 4efce4b to 05501d2 Compare September 18, 2026 15:15
@pabloDeputter
pabloDeputter marked this pull request as ready for review September 18, 2026 15:15
@pabloDeputter
pabloDeputter requested a review from a team as a code owner September 18, 2026 15:15
sentry-warden[bot]
sentry-warden Bot reviewed Sep 18, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/boto3/_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

sentry-warden[bot]
sentry-warden Bot reviewed Sep 18, 2026
View reviewed changes
Comment thread tests/integrations/boto3/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

ericapisani
ericapisani reviewed Sep 18, 2026
View reviewed changes

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things but overall looking good. Will take a look at tests on my 2nd pass

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with heart emoji
All reactions
  • ❤️ 1 reaction
Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
from sentry_sdk.integrations.boto3 import Boto3Integration
@contextmanager
def _activate_client_span(span: "StreamedSpan") -> "Iterator[StreamedSpan]":
"""Temporarily activate an inactive boto span without ending it."""

@ericapisani ericapisani Sep 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding context on why we're doing this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread sentry_sdk/integrations/boto3/_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
# use unknown if `service_id_hyphenized` so span name can still be created.
# e.g. "aws.unkown.GetObject"
service_name = ctx.service_id_hyphenized or "unknown"
span_name = "aws.%s.%s" % (service_name, ctx.operation_name)

@ericapisani ericapisani Sep 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-strings are generally the preferred way to construct strings like this in modern python these days

Suggested change
span_name = "aws.%s.%s" % (service_name, ctx.operation_name)
span_name = f"aws.{service_name}.{ctx.operation_name}"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@pabloDeputter pabloDeputter Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yupp, I took over the old code, but I usually also use f-strings.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
SPANDATA.SENTRY_ORIGIN: span_origin,
}
if ctx.service_id:
attributes[SPANDATA.RPC_METHOD] = "%s/%s" % (

@ericapisani ericapisani Sep 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same f-string comment here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
"sentry.op": OP.HTTP_CLIENT_STREAM,
"sentry.origin": Boto3Integration.origin,
SPANDATA.SENTRY_OP: OP.HTTP_CLIENT_STREAM,
SPANDATA.SENTRY_ORIGIN: Boto3Integration.origin,

@ericapisani ericapisani Sep 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change👌🏻

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with laugh emoji
All reactions
  • 😄 1 reaction
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
Comment on lines +279 to +281
if isinstance(span, StreamedSpan) and (
span.get_attributes().get(SPANDATA.SENTRY_ORIGIN) != Boto3Integration.origin
):

@ericapisani ericapisani Sep 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the length of this conditional, I think it'd be a bit cleaner to pull this into a variable

Suggested change
if isinstance(span, StreamedSpan) and (
span.get_attributes().get(SPANDATA.SENTRY_ORIGIN) != Boto3Integration.origin
):
is_span_origin_from_boto = span.get_attributes().get(SPANDATA.SENTRY_ORIGIN) == Boto3Integration.origin
if isinstance(span, StreamedSpan) and is_span_origin_from_boto:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@pabloDeputter pabloDeputter Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but then you get the issue that the legacy span doesn't support get_attributes(); I fixed it like this:

# an ignored streamed span is not activated; avoid enriching its parent.
if isinstance(span, StreamedSpan):
    if not (span.get_attributes().get(SPANDATA.SENTRY_ORIGIN) == ORIGIN):
        return

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry_sdk/integrations/stdlib.py Outdated
},
# boto3 integration owns span's lifecycle; keep child inactive so it
# can't restore boto3 span later on.
active=not is_inactive_boto3_span,

@ericapisani ericapisani Sep 18, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for this slight nitpick, but can we add a space after the = and before the not?

The "not" almost blends in with the =, especially because the syntax highlighting of Github and IDEs use the same colour for the two. 😭

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with laugh emoji
All reactions
  • 😄 1 reaction

@pabloDeputter pabloDeputter Sep 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but the linter doesn't really like that 🤣 I fixed it by adding fmt: off and fmt: on for that specific block; I haven't seen it being used anywhere else in the codebase, so not sure whether this is correct.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 05501d2 to 421da22 Compare September 21, 2026 09:19
cursor[bot]
cursor Bot reviewed Sep 21, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry_sdk/integrations/boto3/_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/integrations/boto3/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pabloDeputter pabloDeputter closed this Sep 21, 2026
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from c3e8f5b to 66d4665 Compare September 21, 2026 09:38
@pabloDeputter pabloDeputter reopened this Sep 21, 2026
cursor[bot]
cursor Bot reviewed Sep 21, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch 2 times, most recently from fe64ae9 to add0913 Compare September 21, 2026 10:54
cursor[bot]
cursor Bot reviewed Sep 21, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch 3 times, most recently from f649477 to 4423557 Compare September 22, 2026 08:52
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 4423557 to c622458 Compare September 22, 2026 09:18
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from c622458 to 3e4fcfd Compare September 22, 2026 14:53
@pabloDeputter
pabloDeputter removed this pull request from stack #7541 September 22, 2026 14:57
@pabloDeputter
pabloDeputter added this pull request to stack #7618 September 22, 2026 14:57
ericapisani
ericapisani approved these changes Sep 28, 2026
View reviewed changes

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor things but otherwise LGTM 🚀 Approving to not block

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
Track a single API call, including retries, serialization, and endpoint
resolution. For streaming responses, keep the span open until the
response body is consumed or closed.
https://github.com/boto/botocore/blob/develop/botocore/client.py

@ericapisani ericapisani Sep 28, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something got borked in a merge conflict resolution - I can see you made the change in this commit but for some reason it's still using the old path 🤔

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@pabloDeputter pabloDeputter Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I vaguely remember fixing it; so don't know why it was removed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
origin=ORIGIN,
return None

# use unknown if `service_id_hyphenized` so span name can still be created.

@ericapisani ericapisani Sep 28, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a partially incomplete comment - is it supposed to instead be the following?

Suggested change
# use unknown if `service_id_hyphenized` so span name can still be created.
# use unknown if `service_id_hyphenized` is not set so span name can still be created.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
return None

# use unknown if `service_id_hyphenized` so span name can still be created.
# e.g. "aws.unkown.GetObject"

@ericapisani ericapisani Sep 28, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# e.g. "aws.unkown.GetObject"
# e.g. "aws.unknown.GetObject"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 5b894cb to 440b19a Compare September 29, 2026 08:34
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 440b19a to 04d968a Compare September 30, 2026 12:04
@pabloDeputter
pabloDeputter removed this pull request from stack #7618 September 30, 2026 12:05
@pabloDeputter
pabloDeputter added this pull request to stack #7792 September 30, 2026 12:05
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 04d968a to 33807b8 Compare September 30, 2026 13:31
sentry-warden[bot]
sentry-warden Bot reviewed Sep 30, 2026
View reviewed changes
Comment thread tests/integrations/boto3/test_client.py
Comment on lines +171 to +174
assert len(http_spans) == 1
assert len(stream_spans) == 1
client_span = client_spans[0]
http_span = http_spans[0]

@sentry-warden sentry-warden Bot Sep 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS connection putrequest wrapper bypasses the stdlib span wrapper

_install_httplib wraps AWSHTTPConnection.putrequest before replacing HTTPConnection.putrequest, so the AWS wrapper captures the unpatched inherited method. The AWS class then shadows the patched base method, and boto HTTP requests skip stdlib HTTP span setup, including setting _sentrysdk_real_url (the boto client span is still created). Install the base wrapper before wrapping the AWS classes.

Evidence
  • _install_httplib saves the original HTTPConnection.putrequest and defines the sentry wrapper that creates the HTTP span and sets _sentrysdk_real_url.
  • It calls _patch_aws_connection() before assigning that wrapper to HTTPConnection.putrequest.
  • _patch_aws_connection() wraps AWSHTTPConnection.putrequest at that point, capturing the unpatched method; the AWS class method then shadows the later base-class patch, so requests through it skip sentry putrequest.

Identified by Warden · code-review, find-bugs · GUM-LY4

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
pabloDeputter added 9 commits September 30, 2026 16:04
@pabloDeputter
fix(boto3): trace the complete client-call lifecycle
4f3cfce
@pabloDeputter
fix merging issues
644aff8
@pabloDeputter
review changes
608ee4a
@pabloDeputter
add test for when StreamingBody instrumentation setup fails
ec8cef7
@pabloDeputter
fix(boto3): finish streaming spans before legacy boto spans
3a60fb9
@pabloDeputter
add permalink
9c2f329
@pabloDeputter
add some more comments
f9755ca
@pabloDeputter
ref(boto3): use permalink
a9e87f5
@pabloDeputter
ref(boto3): fix grammar in comments
2647da1
@pabloDeputter
pabloDeputter force-pushed the pablo/trace-boto3-client-call-lifecycle branch from 33807b8 to 2647da1 Compare September 30, 2026 14:05
cursor[bot]
cursor Bot reviewed Sep 30, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2647da1. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pabloDeputter
pabloDeputter merged commit 9837c88 into master Sep 30, 2026
169 of 323 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@pabloDeputter
pabloDeputter deleted the pablo/trace-boto3-client-call-lifecycle branch September 30, 2026 15:50
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Oct 12, 2026
publish: getsentry/[email protected] getsentry/publish#9830
Closed
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@sentry-warden sentry-warden[bot] sentry-warden[bot] left review comments
@ericapisani ericapisani ericapisani approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

ref(boto3): Own one logical botocore client-call lifecycle

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@pabloDeputter @ericapisani
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.