
Sentry Go Sdk
Wire Sentry Cron Monitoring check-ins into Go jobs so missed schedules and hung workers surface in Sentry alerts.
Install
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-go-sdkWhat is this skill?
- Detects missed jobs (schedule never ran) and timed-out in-progress check-ins
- CheckIn lifecycle: in_progress → ok | error with optional Duration
- MonitorConfig: Schedule, CheckInMargin, MaxRuntime, Timezone
- Requires github.com/getsentry/sentry-go v0.18.0+ and defer sentry.Flush before exit
- No extra ClientOptions beyond a valid DSN for check-in transport
Adoption & trust: 1k installs on skills.sh; 197 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Azure Kubernetesmicrosoft/azure-skills
Github Actions Docsxixu-me/skills
Deploy To Vercelvercel-labs/agent-skills
Vercel Cli With Tokensvercel-labs/agent-skills
Turborepovercel/turborepo
Docker Expertsickn33/antigravity-awesome-skills
Journey fit
Primary fit
Operate is where scheduled jobs run in production; cron monitors belong on the monitoring shelf, not launch or build. Monitoring covers uptime of background work—check-ins detect skipped crons and in-progress timeouts.
Common Questions / FAQ
Is Sentry Go Sdk safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Sentry Go Sdk
# Crons — Sentry Go SDK > Minimum SDK: `github.com/getsentry/sentry-go` v0.18.0+ Sentry Cron Monitoring detects two failure modes: - **Missed jobs** — the job never ran (schedule was skipped) - **Timed-out jobs** — the job started but ran too long ## Configuration No extra `ClientOptions` are required beyond a valid DSN: ```go sentry.Init(sentry.ClientOptions{ Dsn: os.Getenv("SENTRY_DSN"), }) defer sentry.Flush(2 * time.Second) ``` > Check-ins are async by default — always `defer sentry.Flush()` before program exit. ## Core Types ### `CheckIn` ```go type CheckIn struct { ID EventID // leave zero on start; use *id from start call on completion MonitorSlug string // slug of the monitor in Sentry Status CheckInStatus // in_progress | ok | error Duration time.Duration // optional; set on final check-in } ``` ### `CheckInStatus` constants ```go sentry.CheckInStatusInProgress // "in_progress" — job started sentry.CheckInStatusOK // "ok" — job completed successfully sentry.CheckInStatusError // "error" — job failed ``` ### `MonitorConfig` ```go type MonitorConfig struct { Schedule MonitorSchedule // when the job should run CheckInMargin int64 // minutes of grace period before "missed" MaxRuntime int64 // minutes before in-progress job times out Timezone string // tz database name, e.g. "America/New_York" FailureIssueThreshold int64 // consecutive failures before creating an issue RecoveryThreshold int64 // consecutive successes before auto-resolving } ``` ### Schedule constructors ```go // Standard 5-field cron expression sentry.CrontabSchedule("*/10 * * * *") // Interval-based sentry.IntervalSchedule(1, sentry.MonitorScheduleUnitHour) ``` `MonitorScheduleUnit` constants: `MonitorScheduleUnitMinute`, `MonitorScheduleUnitHour`, `MonitorScheduleUnitDay`, `MonitorScheduleUnitWeek`, `MonitorScheduleUnitMonth`, `MonitorScheduleUnitYear`. > `IntervalSchedule` takes `int64`, not `int`. ## Code Examples ### Check-in pattern (recommended) Sends both a start and a completion check-in. Detects **missed** and **timed-out** jobs. ```go func runHourlyReport() error { monitorConfig := &sentry.MonitorConfig{ Schedule: sentry.CrontabSchedule("0 * * * *"), MaxRuntime: 5, // alert if still running after 5 minutes CheckInMargin: 2, // allow 2 minutes late before "missed" FailureIssueThreshold: 2, // create issue after 2 consecutive failures RecoveryThreshold: 1, // auto-resolve after 1 success Timezone: "America/New_York", } // Send in_progress — pass MonitorConfig here (only needed on first call) checkinID := sentry.CaptureCheckIn( &sentry.CheckIn{ MonitorSlug: "hourly-report", Status: sentry.CheckInStatusInProgress, }, monitorConfig, ) err := generateReport() // Send ok or error — dereference the *EventID returned by start status := sentry.CheckInStatusOK if err != nil { status = sentry.CheckInStatusError } sentry.CaptureCheckIn( &sentry.CheckIn{ ID: *checkinID, // dereference *EventID MonitorSlug: "hourly-report", Status: status, }, nil, // no config needed on completion ) return err } ``` ### Heartbeat pattern Sends only a completion check-in. Detects **missed** jobs only (no timeout detection). ```go func runDailyCleanup() { start := time.Now() cleanupOldRecords() sentry.CaptureCheckIn( &sentry.CheckIn{ MonitorSlug: "daily-cleanup", Status: sentry.CheckInStatusOK, Duration: time.Since(start), }, &sentry.MonitorConfig{ Sche