Skip to content

chore(client-reports): Prevent client report loss when envelope dropped#1195

Merged
szokeasaurusrex merged 2 commits into
masterfrom
szokeasaurusrex/client-report-retry
Jun 24, 2026
Merged

chore(client-reports): Prevent client report loss when envelope dropped#1195
szokeasaurusrex merged 2 commits into
masterfrom
szokeasaurusrex/client-report-retry

Conversation

@szokeasaurusrex

Copy link
Copy Markdown
Member

Prevent client report data from being lost when an envelope containing a client report is dropped by adding all losses from the lost client report back into the aggregator. This ensures that the next outgoing envelope will include the loss data.

This change fixes some undesirable behavior I discovered while manually testing client reports: if the transport queue overflows when sending an error, we record a lost error event. If we then immediately try to send another error, that envelope will pick up the loss, draining it from the aggregator, but if the queue is still full, that envelope will also get lost with the client report. We will record the lost error event from the second envelope, but without this change, we would not include the loss from the first envelope. If we consider the case where many envelopes get sent in rapid succession and overflow the queue, we could end up with a severe undercount of reported losses as a result.

Prevent client report data from being lost when an envelope containing a client report is dropped by adding all losses from the lost client report back into the aggregator. This ensures that the next outgoing envelope will include the loss data.

This change fixes some undesirable behavior I discovered while manually testing client reports: if the transport queue overflows when sending an error, we record a lost error event. If we then immediately try to send another error, that envelope will pick up the loss, draining it from the aggregator, but if the queue is still full, that envelope will also get lost with the client report. We will record the lost error event from the second envelope, but without this change, we would not include the loss from the first envelope. If we consider the case where many envelopes get sent in rapid succession and overflow the queue, we could end up with a severe undercount of reported losses as a result.
@szokeasaurusrex szokeasaurusrex requested a review from lcian as a code owner June 24, 2026 14:54

@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.

Nice.

@szokeasaurusrex szokeasaurusrex merged commit f22532b into master Jun 24, 2026
28 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/client-report-retry branch June 24, 2026 15:18
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