Skip to content

feat(anthropic): Gate prompt collection on data_collection option - #7054

Open
ericapisani wants to merge 4 commits into
masterfrom
py-2588-anthropic
Open

feat(anthropic): Gate prompt collection on data_collection option#7054
ericapisani wants to merge 4 commits into
masterfrom
py-2588-anthropic

Conversation

@ericapisani

Copy link
Copy Markdown
Member

Replace include_prompts and send_default_pii checks with the new data_collection configuration for controlling whether messages and system instructions are captured. Maintain backwards compatibility: when data_collection is not configured, fall back to the legacy pii/include_prompts behavior. Tools are always collected regardless of the message collection setting.

Refs PY-2588

Replace include_prompts and send_default_pii checks with the new data_collection
configuration for controlling whether messages and system instructions are
captured. Maintain backwards compatibility: when data_collection is not
configured, fall back to the legacy pii/include_prompts behavior. Tools are
always collected regardless of the message collection setting.

Refs PY-2588
@ericapisani
ericapisani requested a review from a team as a code owner August 5, 2026 19:49
@linear-code

linear-code Bot commented Aug 5, 2026

Copy link
Copy Markdown

PY-2588

Comment thread sentry_sdk/integrations/anthropic.py
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

71490 passed | ⏭️ 5083 skipped | Total: 76573 | Pass Rate: 93.36% | Execution Time: 256m 1s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -28828
Passed Tests 📉 -27432
Failed Tests
Skipped Tests 📉 -1396

All tests are passing successfully.

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

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/anthropic.py 88.46% ⚠️ 3 Missing and 5 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.95%    89.96%    +0.01%
==========================================
  Files          193       193         —
  Lines        24946     24958       +12
  Branches      9000      9014       +14
==========================================
+ Hits         22439     22453       +14
- Misses        2507      2505        -2
- Partials      1435      1435         —

Generated by Codecov Action

@alexander-alderman-webb

Copy link
Copy Markdown
Contributor

This is currently failing tests so I'll review when they're green

Comment thread sentry_sdk/integrations/anthropic.py Outdated
@ericapisani

Copy link
Copy Markdown
Member Author

@alexander-alderman-webb Got it sorted - the original tests I had written didn't work on older versions of the Anthropic SDK because the tool property wasn't supported at that point in messages.create.

Should be ready for 👀 now

Comment thread sentry_sdk/integrations/anthropic.py Outdated
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