proxy: don't mark ingest.queue_send spans ERROR for expected 4xx body rejections#178
Open
arseniycodes wants to merge 1 commit into
Open
proxy: don't mark ingest.queue_send spans ERROR for expected 4xx body rejections#178arseniycodes wants to merge 1 commit into
arseniycodes wants to merge 1 commit into
Conversation
… rejections EmptyBodyError and PayloadTooLargeError thrown by enqueueStream are handled client errors: the outer handler maps them to 400/413 and the request completes normally (for oversized bodies the S3 multipart upload is aborted first). The inner catch on the ingest.queue_send span still recorded the exception and set ERROR status unconditionally, so every empty or oversized payload produced an ERROR span — and a false-positive incident — for an operation working as designed. Add isExpectedBodyError alongside the error classes in body-capture.ts and skip recordException/setStatus(ERROR) for those two rejections. Genuine enqueue failures (SQS/S3 errors) still mark the span ERROR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a client sends an empty or oversized OTLP body,
enqueueStreamthrowsEmptyBodyError/PayloadTooLargeError. These are handled client errors: the outer catch maps them to 400/413 viahandleIngestBodyError, the S3 multipart upload is aborted for the oversized case, and the request lifecycle completes normally. But the inner catch inside theingest.queue_sendspan unconditionally calledrecordException+setStatus(ERROR), so every such request produced an ERROR span — and a false-positive incident — for an operation working exactly as designed. The surrounding spans (ingest.forward,auth.validate, the server span) all stay Unset, confirming nothing actually failed.Fix
body-capture.ts: newisExpectedBodyError(err)predicate next to the two error classes.index.ts: theingest.queue_sendcatch skipsrecordException/setStatus(ERROR)for expected rejections and still rethrows so the outer handler produces the 4xx. Genuine enqueue failures (SQS/S3 errors) are unchanged and still mark the span ERROR.Testing
isExpectedBodyErrorunit test inbody-capture.test.ts(matches both rejections, rejects generic errors/undefined) — written first, red, then green.tsx --test src/*.test.ts— 89 pass, 0 fail.tsc --noEmitclean.Summary by cubic
Stop marking
ingest.queue_sendspans as ERROR for expected 4xx body rejections (empty or oversized OTLP payloads). This removes false-positive incidents while keeping real SQS/S3 enqueue failures marked as ERROR.isExpectedBodyErroralongsideEmptyBodyErrorandPayloadTooLargeError.index.tsto skiprecordExceptionandsetStatus(ERROR)for expected rejections; still rethrows so the outer handler returns 400/413.isExpectedBodyError; full proxy test suite passes.Written for commit 3025064. Summary will update on new commits.