Skip to content

rotation-release-id-pollution-check: dual-report alerts to PostHog - #3489

Merged
jakebromberg merged 3 commits into
mainfrom
orchestrator/rotation-release-id-pollution-check-dual-report-to
Oct 18, 2026
Merged

jakebromberg merged 3 commits into
mainfrom
orchestrator/rotation-release-id-pollution-check-dual-report-to

Conversation

@jakebromberg

@jakebromberg jakebromberg commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Closes #3410

Part of #3393 (Sentry exit), slice B8. This is observability plumbing, so the post-launch hardening freeze (project #32) does not apply.

jobs/rotation-release-id-pollution-check now mirrors its Sentry emit_alert (message) and main() exception sites to PostHog error tracking through a fail-open posthog-python client keyed on POSTHOG_ERRORS_API_KEY (optional; unset means Sentry-only, behavior unchanged). Message-only alerts are sent as a synthesized $exception whose $exception_fingerprint is the fingerprint_for(kind, rotation_id) parts joined with : into one string (PostHog types the property as a single string and drops a list as InvalidProperties), e.g. rotation-release-id-pollution-check:mismatch:123, and rotation-release-id-pollution-check:run-degraded for the per-run alert, so PostHog groups the same way Sentry does, with repo/tool/run_id properties. Sends go through a small token bucket (burst 50, 1/s); a dropped send logs posthog_send_dropped. The client is shut down (flushed) in finally. DRY_RUN suppresses PostHog exactly where it suppresses Sentry. Sentry stays.

Known limit: posthog-python's shutdown() has no drain timeout, so a PostHog outage at exit can hold the process until the SDK's own request timeouts give up. Left as is.

Tests: the payload, the string fingerprint, the bucket, no-key, DRY_RUN, the non-DRY_RUN PostHog path, the job-failure report, fail-open when the client raises, and the empty-bucket drop are pinned in self_test(), which the jest test:unit shell-out and the Dockerfile build run. Local: job.py --self-test and the job's jest suite pass, prettier is clean.

npm run ci:testmock was not run locally (Docker was not running); GitHub CI runs the integration suite on this PR, since the repo is public.

jakebromberg and others added 3 commits October 18, 2026 15:45
…Hog with the per-rotation fingerprint (BS#3410)
…rectly at exit so the token bucket cannot drop it (BS#3410)
…t string, not a list (BS#3410)

PostHog's error-tracking processor types `$exception_fingerprint` as one string, so the list form dropped every alert as InvalidProperties. The PostHog half now sends the fingerprint_for() parts joined with ":" (the per-run alert sends `rotation-release-id-pollution-check:run-degraded`); fingerprint_for() is unchanged for Sentry.

The flood guard now logs `posthog_send_dropped` when it drops a send, the job-failure report moves into posthog_report_exception(), and self_test() covers the non-DRY_RUN PostHog path, the failure report, fail-open when the client raises, and an empty bucket. The env-var entry moves under its own PostHog heading.
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.

rotation-release-id-pollution-check: dual-report to PostHog with its per-rotation fingerprint

1 participant