FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(openai): Add `gen_ai.request.reasoning.level` to OpenAI spans by pabloDeputter · Pull Request #6892 · getsentry/sentry-python · GitHub

feat(openai): Add gen_ai.request.reasoning.level to OpenAI spans - #6892

Merged
pabloDeputter merged 6 commits into
masterfrom
pablo/genai-request-reasoning-level
Jul 27, 2026
Merged

feat(openai): Add gen_ai.request.reasoning.level to OpenAI spans#6892
pabloDeputter merged 6 commits into
masterfrom
pablo/genai-request-reasoning-level

Conversation

pabloDeputter commented Jul 27, 2026
edited
Loading

Copy link
Copy Markdown
Member

Description

Add gen_ai.request.reasoning.level to OpenAI spans for:

  • Responses API via reasoning.effort
  • Chat Completions API via reasoning_effort

Issues

Refs: #6877 & #6878; PY-2620 & PY-2621

Reminders

…s Api

Read `effort` field from the `reasoning`request parameter from `responses.create()` and set it on the gen_ai span as `gen_ai.request.reasoning_level`. `reasoning`may be passed as a dict or as the SDK's `Reasoning`object.

Refs #6878
Refs PY-2621
…ons Api

Read `reasoning_effort` request parameter from `chat.completions.create()` and set it on the gen_ai span as `gen_ai.request.reasoning_level`.

Refs #6877
Refs PY-2620

github-actions Bot commented Jul 27, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Codecov Results 📊

98651 passed | ⏭️ 6806 skipped | Total: 105457 | Pass Rate: 93.55% | Execution Time: 360m 11s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +564
Passed Tests 📈 +373
Failed Tests 📉 -1
Skipped Tests 📈 +192

➖ Removed Tests (1)

View removed tests
  • test_circular_references_span_streaming
    • File: tests.tracing.test_misc

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2508 uncovered lines.
✅ Project coverage is 89.72%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.69%    89.72%    +0.03%
==========================================
  Files          193       193         —
  Lines        24437     24402       -35
  Branches      8660      8648       -12
==========================================
+ Hits         21919     21894       -25
- Misses        2518      2508       -10
- Partials      1398      1400        +2

Generated by Codecov Action

pabloDeputter marked this pull request as ready for review July 27, 2026 11:56
pabloDeputter requested a review from a team as a code owner July 27, 2026 11:56
Comment thread sentry_sdk/consts.py Outdated

alexander-alderman-webb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you also co-locate assertions with assertions on other request configuration such asgen_ai.request.top_p, gen_ai.request.temperature, etc ...

That way, we ensure that the attribute is set in all scenarios we test against, such as streaming and non-streaming, sync and async, etc ...

Comment thread sentry_sdk/integrations/openai.py Outdated

cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Cursor Bugbot has reviewed your changes and found 2 potential issues.

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

Reviewed by Cursor Bugbot for commit a509b01. Configure here.

alexander-alderman-webb left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice, LGTM!

Copy link
Copy Markdown
Contributor

As discussed in person, adding the assertions to existing tests is ugly because it's not available on old openai versions. Feel free to go with your original approach with adding a few new tests @pabloDeputter!

Copy link
Copy Markdown
Contributor

You can merge whenever you've passed CI since I've approved the PR already.
We trust each other to make the relevant changes and merge when we approve with a comment

pabloDeputter merged commit 54f77b9 into master Jul 27, 2026
523 of 529 checks passed
pabloDeputter deleted the pablo/genai-request-reasoning-level branch July 27, 2026 14:14
mgaligniana pushed a commit to mgaligniana/sentry-python that referenced this pull request Aug 9, 2026
…etsentry#6892)

### Description
Add `gen_ai.request.reasoning.level` to OpenAI spans for:
- Responses API via `reasoning.effort`
- Chat Completions API via `reasoning_effort`

#### Issues
Refs: getsentry#6877 & getsentry#6878; PY-2620 & PY-2621
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL