Repository navigation
Skip the Sentry heartbeat when PIXEL_ENV=local - #132
Merged
Merged
Conversation
A laptop running `just dev` with a DSN checked in to a shared `pixel-local` cron monitor, so stopping it opened an issue about ten minutes later. `planHeartbeat` now decides whether to run it (off without a DSN, with PIXEL_HEARTBEAT_MINUTES=0, or for local), and startup logs `heartbeat.off` with the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NinjaLikesCheez
force-pushed
the
fix/heartbeat-skip-local
branch
from
October 19, 2026 08:29
e306b62 to
1d139c7
Compare
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.
What was wrong
src/index.tsstarted the Sentry cron heartbeat wheneverSENTRY_DSNwas set, with slugpixel-${env}.PIXEL_ENVdefaults tolocal, and the monitor usesfailureIssueThreshold: 1. So any developer runningjust devwith a DSN created or updated one sharedpixel-localmonitor, and every time they stopped it an issue opened about ten minutes later (with several developers checking in to the same monitor, it also flapped). The runbook only describespixel-devandpixel-prod.What changed
planHeartbeat(config)insrc/observability/heartbeat.tsis a plain function that returns either the monitor to check in to or why the heartbeat is off (no-sentry,disabled,local). It's off forPIXEL_ENV=local.src/index.tsuses it (small change around the existing block) and logsheartbeat.offwith the reason at info level when it's skipped.docs/architecture.md(heartbeat section and config table),docs/runbook.md(monitoring section; also says to delete a leftoverpixel-localmonitor in Sentry if one exists), and.env.example.CHANGELOG.md:Fixedentry.pixel-devandpixel-prodbehave as before.Testing
planHeartbeattests insrc/observability/heartbeat.test.ts: dev/prod getpixel-dev/pixel-prodat the configured interval,localwith a DSN is off, and it's off with no DSN, an empty DSN orPIXEL_HEARTBEAT_MINUTES=0.just checkpasses (lint, typecheck, tests, coverage thresholds).🤖 Generated with Claude Code