Skip to content

Skip the Sentry heartbeat when PIXEL_ENV=local - #132

Merged
NinjaLikesCheez merged 1 commit into
mainfrom
fix/heartbeat-skip-local
Oct 19, 2026
Merged

NinjaLikesCheez merged 1 commit into
mainfrom
fix/heartbeat-skip-local

Conversation

@NinjaLikesCheez

Copy link
Copy Markdown
Contributor

What was wrong

src/index.ts started the Sentry cron heartbeat whenever SENTRY_DSN was set, with slug pixel-${env}. PIXEL_ENV defaults to local, and the monitor uses failureIssueThreshold: 1. So any developer running just dev with a DSN created or updated one shared pixel-local monitor, 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 describes pixel-dev and pixel-prod.

What changed

  • planHeartbeat(config) in src/observability/heartbeat.ts is 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 for PIXEL_ENV=local.
  • src/index.ts uses it (small change around the existing block) and logs heartbeat.off with the reason at info level when it's skipped.
  • Docs: docs/architecture.md (heartbeat section and config table), docs/runbook.md (monitoring section; also says to delete a leftover pixel-local monitor in Sentry if one exists), and .env.example.
  • CHANGELOG.md: Fixed entry.

pixel-dev and pixel-prod behave as before.

Testing

  • New planHeartbeat tests in src/observability/heartbeat.test.ts: dev/prod get pixel-dev / pixel-prod at the configured interval, local with a DSN is off, and it's off with no DSN, an empty DSN or PIXEL_HEARTBEAT_MINUTES=0.
  • just check passes (lint, typecheck, tests, coverage thresholds).

🤖 Generated with Claude Code

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
NinjaLikesCheez force-pushed the fix/heartbeat-skip-local branch from e306b62 to 1d139c7 Compare October 19, 2026 08:29
@NinjaLikesCheez
NinjaLikesCheez merged commit 965db46 into main Oct 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant