Skip to content

feat(openai): Gate response output collection on data collection options - #7035

Merged
ericapisani merged 4 commits into
masterfrom
py-2588-openai-set-common-output-data
Aug 5, 2026
Merged

feat(openai): Gate response output collection on data collection options#7035
ericapisani merged 4 commits into
masterfrom
py-2588-openai-set-common-output-data

Conversation

@ericapisani

@ericapisani ericapisani commented Aug 4, 2026

Copy link
Copy Markdown
Member

Gate OpenAI response text and tool calls collection on the new data_collection settings, giving precedence over the legacy send_default_pii flag for backwards compatibility.

Applies to Chat Completions API, Responses API, and their streaming variants.

Refs PY-2588

For reviewers

The git diff, while large, is not as large as Github is making it out to be. My suggestion would be to review the changes in openai.py here and, for reviewing the tests, checkout this branch and look up the following tests individually that were added as part of these changes:

test_completions_api_data_collection_outputs
test_completions_api_data_collection_outputs_async
test_completions_api_data_collection_outputs_empty_choices
test_streaming_chat_completion_data_collection_outputs
test_streaming_chat_completion_data_collection_outputs_async
test_streaming_responses_api_data_collection_outputs
test_responses_api_data_collection_outputs_shapes
test_responses_api_data_collection_outputs

Gate OpenAI response text and tool calls collection on the new
data_collection settings, giving precedence over the legacy send_default_pii
flag for backwards compatibility.

Applies to Chat Completions API, Responses API, and their streaming variants.

Refs PY-2588
@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown

PY-2588

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

98904 passed | ⏭️ 6479 skipped | Total: 105383 | Pass Rate: 93.85% | Execution Time: 350m 16s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +2480
Passed Tests 📈 +2192
Failed Tests
Skipped Tests 📈 +288

All tests are passing successfully.

✅ Patch coverage is 95.45%. Project has 2497 uncovered lines.
✅ Project coverage is 89.96%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/openai.py 95.45% ⚠️ 2 Missing and 2 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.90%    89.96%    +0.06%
==========================================
  Files          193       193         —
  Lines        24822     24859       +37
  Branches      8924      8962       +38
==========================================
+ Hits         22315     22362       +47
- Misses        2507      2497       -10
- Partials      1417      1412        -5

Generated by Codecov Action

@ericapisani
ericapisani marked this pull request as ready for review August 5, 2026 13:54
@ericapisani
ericapisani requested a review from a team as a code owner August 5, 2026 13:54
@ericapisani
ericapisani merged commit d8cdbd2 into master Aug 5, 2026
145 checks passed
@ericapisani
ericapisani deleted the py-2588-openai-set-common-output-data branch August 5, 2026 15:52
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