Skip to content

Report endpoint_payload.dropped when the orchestrator removes a stored payload#273

Merged
ypopovych merged 1 commit into
mainfrom
yehor.popovych/sdtest-3777-endpoint-dropped
Jun 3, 2026
Merged

Report endpoint_payload.dropped when the orchestrator removes a stored payload#273
ypopovych merged 1 commit into
mainfrom
yehor.popovych/sdtest-3777-endpoint-dropped

Conversation

@ypopovych

@ypopovych ypopovych commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What

First slice of SDTEST-3777 — wires the producer side of endpoint_payload.dropped. The consumer side (onDropped → endpoint_payload.dropped.add(endpoint:)) was already added in #272; this connects it to where payloads are actually discarded.

Why

FilesOrchestrator silently deletes stored batches that are never uploaded:

  • too old — older than maxFileAgeForRead (during read scans and directory purge), and
  • purged to keep the directory under maxDirectorySize.

Neither was observable. Both are exactly what endpoint_payload.dropped ("payloads dropped after all retries") is meant to count.

How

  • FilesOrchestrator gains an onDrop: (@Sendable (Int) -> Void)? callback, invoked with the dropped file's byte size outside the state lock (so the observer can't contend with file ops). Age-purge drops are collected in fileInfos and reported by getReadableFile/getAllReadableFiles after the lock; size-purge drops are reported directly in purgeFilesDirectoryIfNeeded.
  • Successful upload deletions (delete(readableFile:)) are not reported.
  • Wired for spans (test_cycle) and coverage (code_coverage) via observers.upload.uploadDropped.

Testing

  • testGivenFileTooOld_whenScanned_itReportsDropWithSize — too-old file reports a drop with its size.
  • testGivenSuccessfulRead_whenDeleted_itDoesNotReportDrop — marked-as-read deletions are not drops.
  • Full EventsExporter suite: 134 tests pass.

Architecture doc updated (moves endpoint_payload.dropped from TODO to gathered).

🤖 Generated with Claude Code

…d payload

`FilesOrchestrator` silently deletes stored batches that are never uploaded —
too old (`maxFileAgeForRead`) or purged to keep the directory under
`maxDirectorySize`. Add an `onDrop` callback (invoked with the file's byte size,
outside the state lock) wired to `UploadObserver.uploadDropped`, so those
removals are counted as `endpoint_payload.dropped`. Successful upload deletions
(`delete(readableFile:)`) are not reported. Wired for spans and coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ypopovych
ypopovych force-pushed the yehor.popovych/sdtest-3777-endpoint-dropped branch from 9bc64a2 to dc34f38 Compare June 3, 2026 14:56
@ypopovych
ypopovych requested a review from anmarchenko June 3, 2026 15:01
@ypopovych
ypopovych merged commit 633388a into main Jun 3, 2026
11 checks passed
@ypopovych
ypopovych deleted the yehor.popovych/sdtest-3777-endpoint-dropped branch June 3, 2026 15:06
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