Skip to content

feat(crons): check_in ingest + monitor staleness alerts - #364

Open
ajianaz wants to merge 2 commits into
developfrom
feat/crons-check-in
Open

ajianaz wants to merge 2 commits into
developfrom
feat/crons-check-in

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

What

  • Sentry Crons compatibility: check_in envelope items are parsed and stored; monitors auto-register on first check-in (monitors + monitor_checkins, migration 007 Postgres / timestamped SQLite).
  • Hourly staleness evaluation: a crontab-scheduled monitor that misses its expected check-in (+ checkin_margin, default 60 min) flips to missed and emits an alert. UTC-only 5-field crontab matcher, no new dependencies.
  • Alert engine generalized to AlertSignal::{Issue, MonitorMissed} — one webhook pipeline for both signal types, existing cooldown respected. Monitor-missed webhook payload: {"type":"monitor_missed",...}.
  • APIs: GET /api/0/projects/{slug}/monitors, GET /api/0/projects/{slug}/monitors/{id}/checkins (paginated).
  • MCP: new list_monitors tool.
  • Retention purge covers check-in history; monitor state rows are kept. alert_history.issue_id stores monitor:<slug> for monitor alerts.

Why

Closes #360. Scheduled jobs (backups, workers, crons) fail silently — error tracking alone never sees a job that never ran. Any Sentry SDK can now report monitor check-ins via the same drop-in DSN swap; staleness alerts flow to the existing Discord/Slack webhooks.

Testing

  • cargo fmt --all -- --check clean.
  • cargo clippy --workspace --all-targets -- -D warnings clean.
  • cargo test --workspace green: trapfalld unit 92, integration 43, MCP 17 — includes new tests: envelope check_in parse, staleness evaluation (fixed timestamps), end-to-end ingest→monitor list→checkins pagination (integration, real envelope POST with sentry-key auth), monitor-missed webhook dispatch + cooldown (offline), retention purge deletes old check-ins / keeps monitors, MCP list_monitors.
  • Postgres dialect compiled under --features postgres (clippy clean); live-PG path exercised by the CI test-postgres job.
  • Gates independently re-executed by the orchestrator, not taken from the implementer's self-report.

Limitations (documented in code): timezone field ignored (UTC), interval-type schedules not evaluated, monitor slug length capped at 128.

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.

feat: Sentry Crons — check_in ingest + monitor staleness alerts

1 participant