Repository navigation
Skip benign 404 control-flow defects in error tracking - #5
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
Internet vulnerability scanners constantly probe non-existent routes (`/.env`, `/.git/config`, `/admin/*`, etc.). The resulting 404s travel through the Effect defect channel and were forwarded to PostHog's `captureException` by the global capture hook, flooding error tracking with two noisy issues (`CapturedNonError` and `CapturedObject: "Response returned status 404."`) and burning triage time. These 404s are benign control flow, not real errors. `captureUnexpectedDefect` now skips them before calling `captureException`: Effect `HttpServerResponse` defects with status 404, and the thrown-response 404 captured as "Response returned status 404.". Genuine defects are unaffected. Generated-By: PostHog Code Task-Id: 595ab1eb-bf72-49a7-b26b-d2f99d407b4f
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.
Why
Error tracking for the API was being flooded with non-errors, drowning out real issues and burning triage time. Internet vulnerability scanners constantly probe non-existent routes (
/.env,/.git/config,/laravel/.env,/admin/*, etc.), and the global capture hook inobservability.tswas forwarding every resulting 404 defect to PostHog. This produced two high-volume false-positive issues —CapturedNonError(EffectHttpServerResponse404) andCapturedObject: "Response returned status 404."— both already manually resolved as noise.What
captureUnexpectedDefectnow skips benign 404 control-flow defects before callingcaptureException:HttpServerResponsedefects withstatus === 404(reusing theisHttpServerResponseguard already used in the billing handler)"Response returned status 404."These are benign control flow from unmatched routes, not real errors. Genuine defects still flow through unchanged, and the 404 responses / request metrics are untouched.
Note
I couldn't run
aube run check/aube run test— theaubetoolchain andnode_modulesaren't available in this environment. The change is small and the two defect shapes were confirmed against the live exception data.Created with PostHog Code from an inbox report.