Skip to content

feat: Add AddToTransactions to SentryAttachment#5182

Open
jamescrosswell wants to merge 5 commits intomainfrom
feature/add-attachment-add-to-transactions
Open

feat: Add AddToTransactions to SentryAttachment#5182
jamescrosswell wants to merge 5 commits intomainfrom
feature/add-attachment-add-to-transactions

Conversation

@jamescrosswell
Copy link
Copy Markdown
Collaborator

@jamescrosswell jamescrosswell commented May 4, 2026

Summary

  • Adds AddToTransactions boolean property to SentryAttachment (defaults to false)
  • New constructor overload: SentryAttachment(type, content, fileName, contentType, addToTransactions)
  • Envelope.FromTransaction now accepts optional attachments parameter and includes those with AddToTransactions = true
  • SentryClient.CaptureTransaction filters attachments to only pass AddToTransactions = true ones to the envelope

Implements #750. See also the Java reference implementation and the SDK spec.

🤖 Generated with Claude Code

Adds an `AddToTransactions` boolean property to `SentryAttachment` (default `false`) that controls whether attachments are included in transaction envelopes. Previously attachments were never sent with transactions; now those with `AddToTransactions = true` are included.

Closes #750

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jamescrosswell jamescrosswell requested a review from Flash0ver as a code owner May 4, 2026 04:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.09%. Comparing base (32a55e3) to head (0ee50c0).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
src/Sentry/Protocol/Envelopes/Envelope.cs 57.14% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5182      +/-   ##
==========================================
+ Coverage   74.06%   74.09%   +0.02%     
==========================================
  Files         501      506       +5     
  Lines       18113    18260     +147     
  Branches     3521     3568      +47     
==========================================
+ Hits        13415    13529     +114     
- Misses       3838     3859      +21     
- Partials      860      872      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell marked this pull request as draft May 4, 2026 05:25
Comment thread src/Sentry/Protocol/Envelopes/Envelope.cs Outdated
jamescrosswell and others added 3 commits May 5, 2026 16:29
Replace the optional-parameter signature with two explicit overloads:
- original single-arg overload delegates to the new one (binary compat)
- new overload takes logger + attachments without defaults

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The two focused tests (true includes, false excludes) already cover
the filtering logic completely. The mixed-attachments test added no
additional coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jamescrosswell jamescrosswell marked this pull request as ready for review May 7, 2026 04:54
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