Skip to content

Reproduction for sentry-python#5349#9

Open
sl0thentr0py wants to merge 1 commit intomainfrom
repro/sentry-python-5349
Open

Reproduction for sentry-python#5349#9
sl0thentr0py wants to merge 1 commit intomainfrom
repro/sentry-python-5349

Conversation

@sl0thentr0py
Copy link
Member

Summary

Reproduction for getsentry/sentry-python#5349

This reproduces the issue where requests library calls show incorrect/very short timing (< 1ms) in http.client spans with sentry-sdk 2.x. In version 1.45, the spans correctly measured the actual HTTP request duration.

How to run

cd sentry-python/5349
uv sync
export SENTRY_DSN=your_dsn_here
uv run python main.py

Then hit http://localhost:8000/ or http://localhost:8000/multiple-requests and check the traces in Sentry.

Expected behavior

The http.client spans for requests to httpbin.org/delay/1 should show approximately 1000ms duration.

Actual behavior

The http.client spans show impossibly short times (< 1ms) that don't reflect the real I/O time.

🤖 Generated with Claude Code

Reproduces the issue where requests library calls show incorrect/very
short timing (< 1ms) in http.client spans with sentry-sdk 2.x.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a 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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


# Make 3 requests, each should take ~1 second
for i in range(3):
response = requests.get(f"https://httpbin.org/delay/1")
Copy link

Choose a reason for hiding this comment

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

Unnecessary f-string with no variable interpolation

Low Severity

The f-string f"https://httpbin.org/delay/1" on line 75 doesn't interpolate any variables, making the f prefix unnecessary. The loop variable i is available but not used in the URL. This is inconsistent with line 53, which correctly uses a plain string "https://httpbin.org/delay/1" for the same URL.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant