Skip to content

feat(types): Add client report loss source API - #1170

Merged
szokeasaurusrex merged 7 commits into
szokeasaurusrex/client-report-protocolfrom
szokeasaurusrex/envelope-loss-item
Jun 24, 2026
Merged

szokeasaurusrex merged 7 commits into
szokeasaurusrex/client-report-protocolfrom
szokeasaurusrex/envelope-loss-item

Conversation

@szokeasaurusrex

@szokeasaurusrex szokeasaurusrex commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

Add a sealed LossSource trait so supported protocol values can describe the client report data categories and quantities lost when they are discarded.

This standardizes how different telemetry items are counted as client report losses. Envelope and EnvelopeItem both implement LossSource, along with the supported envelope item payload types.

The loss mapping covers:

  • events, sessions, transactions, spans, attachments, and monitor check-ins
  • log item counts and serialized log bytes
  • trace metric counts and serialized trace metric bytes

Client report items and raw envelope items intentionally do not produce additional losses.

Resolves #1171
Resolves RUST-242

@github-actions

github-actions Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 82d07d6

@szokeasaurusrex szokeasaurusrex changed the title szokeasaurusrex/envelope loss item feat(types): Add dropped envelope loss APIs Jun 17, 2026
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

RUST-242

@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch 6 times, most recently from f10c34a to ea819f9 Compare June 17, 2026 15:52
@szokeasaurusrex
szokeasaurusrex marked this pull request as ready for review June 17, 2026 15:54
@szokeasaurusrex
szokeasaurusrex requested a review from lcian as a code owner June 17, 2026 15:54
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from ea819f9 to d3dd20b Compare June 17, 2026 16:03
@szokeasaurusrex
szokeasaurusrex changed the base branch from szokeasaurusrex/transport-report-recorder to szokeasaurusrex/client-report-protocol June 17, 2026 16:03
@szokeasaurusrex
szokeasaurusrex requested a review from lcian June 18, 2026 09:07
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 7034485 to 64f6173 Compare June 18, 2026 10:01
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 67684a5 to 346c3f6 Compare June 18, 2026 15:05
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 346c3f6 to 978829b Compare June 19, 2026 08:46

@lcian lcian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 978829b to 9b9ac77 Compare June 19, 2026 12:08
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 9b9ac77 to b07e9bd Compare June 19, 2026 16:05
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from b07e9bd to fc43fb1 Compare June 19, 2026 16:33
@szokeasaurusrex szokeasaurusrex changed the title feat(types): Add dropped envelope loss APIs feat(types): Add dropped envelope item loss API Jun 21, 2026
@szokeasaurusrex
szokeasaurusrex requested a review from lcian June 21, 2026 16:36
@szokeasaurusrex

Copy link
Copy Markdown
Member Author

@lcian I changed this around a bit in 581d5d4, still looks good?

@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 581d5d4 to 52c53d1 Compare June 22, 2026 08:12

@lcian lcian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, looks good.

@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from 52c53d1 to d187485 Compare June 22, 2026 11:20
@szokeasaurusrex
szokeasaurusrex marked this pull request as draft June 22, 2026 15:07
@szokeasaurusrex szokeasaurusrex changed the title feat(types): Add dropped envelope item loss API feat(types): Add client report loss source API Jun 22, 2026
szokeasaurusrex and others added 5 commits June 23, 2026 11:36
Add `Envelope::losses_on_drop` so transports can inspect an envelope before dropping it and report the data categories and quantities that were lost through client reports.

The new mapping covers all parsed envelope item types that contribute reportable losses:

- events, sessions, transactions, spans, attachments, and monitor check-ins
- log item counts and serialized log bytes
- trace metric counts

Expose `EnvelopeLossIter` from `sentry-types` and add the client report `Category` variants needed to represent the resulting losses. Client report items and raw envelope items intentionally do not produce additional losses.

Add a changelog entry for the new dropped-envelope loss APIs.

Resolves [#1171](#1171)
Resolves [RUST-242](https://linear.app/getsentry/issue/RUST-242)
Expose a sealed trait for protocol values that can describe their client report losses. Keep the concrete loss iterators private so the public API does not commit to the internal representation.
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/envelope-loss-item branch from e0f982a to cb9d481 Compare June 23, 2026 09:37
@szokeasaurusrex

Copy link
Copy Markdown
Member Author

@lcian I changed this around one last time in cb9d481; now I have a LossSource trait that we can use to record basically any lost data type.

@szokeasaurusrex
szokeasaurusrex marked this pull request as ready for review June 23, 2026 11:00
@szokeasaurusrex
szokeasaurusrex merged commit c1ff1ae into master Jun 24, 2026
27 checks passed
@szokeasaurusrex
szokeasaurusrex deleted the szokeasaurusrex/envelope-loss-item branch June 24, 2026 12:43
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