From be4c570a4bdcec4b310f9a9556220ab176957f67 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 16 Oct 2026 17:42:52 -0700 Subject: [PATCH 1/5] docs(crons): Add gocron setup for Go Co-Authored-By: Claude --- platform-includes/crons/setup/go.mdx | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/platform-includes/crons/setup/go.mdx b/platform-includes/crons/setup/go.mdx index 597bdcc3413f9..0851a11f28acc 100644 --- a/platform-includes/crons/setup/go.mdx +++ b/platform-includes/crons/setup/go.mdx @@ -87,6 +87,37 @@ scheduler.Register("0 * * * *", sentryasynq.WithMonitor(task, "", `Exclude` skips task types by exact name, and `ExcludePatterns` by regular expression. Periodic tasks that share a task type aren't monitored by `NewConfigProvider`, so give them their own slugs with `sentryasynq.WithMonitor`. Pass task options to `Register` instead of `asynq.NewTask`, since a task created with options can't be marked. Schedules that can't be expressed in the Crons schedule format (for example, a task that runs every 10 seconds) send check-ins without creating the monitor. The asynq integration ships in the next release of `sentry-go`. +### gocron + +If you schedule jobs with [gocron v2](https://github.com/go-co-op/gocron) (v2.20.0 or higher), install the package: + +```bash +go get github.com/getsentry/sentry-go/gocron +``` + +Pass `sentrygocron.NewSchedulerMonitor` to `gocron.WithSchedulerMonitor` to monitor every job. Each job name becomes a monitor slug, and cron and duration jobs use their schedule and the scheduler's location as the monitor schedule and timezone: + +```go +import ( + "time" + + "github.com/go-co-op/gocron/v2" + sentrygocron "github.com/getsentry/sentry-go/gocron" +) + +s, err := gocron.NewScheduler( + gocron.WithLocation(time.UTC), + gocron.WithSchedulerMonitor(sentrygocron.NewSchedulerMonitor(sentrygocron.Options{ + // Same as gocron.WithLocation. Defaults to time.Local. + Location: time.UTC, + Exclude: []string{""}, + })), +) +s.NewJob(gocron.CronJob("0 * * * *", false), gocron.NewTask(task), gocron.WithName("")) +``` + +Name your jobs with `gocron.WithName`. Jobs running an anonymous function without a name, and jobs sharing a name, aren't monitored. `Exclude` skips jobs by exact name, and `ExcludePatterns` by regular expression. Daily, weekly, monthly, random and one-time jobs, and schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds), send check-ins without creating the monitor. The gocron integration ships in the next release of `sentry-go`. + ### Manual Check-Ins To send check-ins yourself, call `sentry.CaptureCheckIn` at the start and end of your job. Pass a monitor config with the in-progress check-in so Sentry creates or updates the monitor from your code: From bb6489f0216f14057c0153dbc0bbe4a294bd799e Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 20 Oct 2026 10:23:02 -0700 Subject: [PATCH 2/5] docs(crons): Fix the minimum gocron version Co-Authored-By: Claude --- platform-includes/crons/setup/go.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/crons/setup/go.mdx b/platform-includes/crons/setup/go.mdx index 0851a11f28acc..e88cd66c3ff79 100644 --- a/platform-includes/crons/setup/go.mdx +++ b/platform-includes/crons/setup/go.mdx @@ -89,7 +89,7 @@ scheduler.Register("0 * * * *", sentryasynq.WithMonitor(task, "", ### gocron -If you schedule jobs with [gocron v2](https://github.com/go-co-op/gocron) (v2.20.0 or higher), install the package: +If you schedule jobs with [gocron v2](https://github.com/go-co-op/gocron) (v2.22.0 or higher), install the package: ```bash go get github.com/getsentry/sentry-go/gocron From 2dc9dbad217a735355f77dd0ca0b457a6008b109 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 20 Oct 2026 10:45:09 -0700 Subject: [PATCH 3/5] docs(crons): Pass a context to the gocron scheduler monitor Co-Authored-By: Claude --- platform-includes/crons/setup/go.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform-includes/crons/setup/go.mdx b/platform-includes/crons/setup/go.mdx index e88cd66c3ff79..d49998f6e6bba 100644 --- a/platform-includes/crons/setup/go.mdx +++ b/platform-includes/crons/setup/go.mdx @@ -95,10 +95,11 @@ If you schedule jobs with [gocron v2](https://github.com/go-co-op/gocron) (v2.22 go get github.com/getsentry/sentry-go/gocron ``` -Pass `sentrygocron.NewSchedulerMonitor` to `gocron.WithSchedulerMonitor` to monitor every job. Each job name becomes a monitor slug, and cron and duration jobs use their schedule and the scheduler's location as the monitor schedule and timezone: +Pass `sentrygocron.NewSchedulerMonitor` to `gocron.WithSchedulerMonitor` to monitor every job. Each job name becomes a monitor slug, and cron and duration jobs use their schedule and the scheduler's location as the monitor schedule and timezone. Check-ins go to the client carried by the context, or the global client: ```go import ( + "context" "time" "github.com/go-co-op/gocron/v2" @@ -107,7 +108,7 @@ import ( s, err := gocron.NewScheduler( gocron.WithLocation(time.UTC), - gocron.WithSchedulerMonitor(sentrygocron.NewSchedulerMonitor(sentrygocron.Options{ + gocron.WithSchedulerMonitor(sentrygocron.NewSchedulerMonitor(context.Background(), sentrygocron.Options{ // Same as gocron.WithLocation. Defaults to time.Local. Location: time.UTC, Exclude: []string{""}, From 8c93375fdbdbf2319c571767051429f91363ecde Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Thu, 29 Oct 2026 11:01:41 -0700 Subject: [PATCH 4/5] docs(go): Note that gocron skips jobs with unsupported schedules --- platform-includes/crons/setup/go.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/crons/setup/go.mdx b/platform-includes/crons/setup/go.mdx index d49998f6e6bba..66c6956d43e0a 100644 --- a/platform-includes/crons/setup/go.mdx +++ b/platform-includes/crons/setup/go.mdx @@ -117,7 +117,7 @@ s, err := gocron.NewScheduler( s.NewJob(gocron.CronJob("0 * * * *", false), gocron.NewTask(task), gocron.WithName("")) ``` -Name your jobs with `gocron.WithName`. Jobs running an anonymous function without a name, and jobs sharing a name, aren't monitored. `Exclude` skips jobs by exact name, and `ExcludePatterns` by regular expression. Daily, weekly, monthly, random and one-time jobs, and schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds), send check-ins without creating the monitor. The gocron integration ships in the next release of `sentry-go`. +Name your jobs with `gocron.WithName`. Jobs running an anonymous function without a name, and jobs sharing a name, aren't monitored. `Exclude` skips jobs by exact name, and `ExcludePatterns` by regular expression. Daily, weekly, monthly, random and one-time jobs, and schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds), aren't monitored. The gocron integration ships in the next release of `sentry-go`. ### Manual Check-Ins From 50e9540e52c2d6a3eac208d353e6c8683e8997fd Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Thu, 29 Oct 2026 11:12:51 -0700 Subject: [PATCH 5/5] docs(crons): Note gocron daily, weekly and monthly jobs are monitored --- platform-includes/crons/setup/go.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform-includes/crons/setup/go.mdx b/platform-includes/crons/setup/go.mdx index 66c6956d43e0a..71b9f78eabb72 100644 --- a/platform-includes/crons/setup/go.mdx +++ b/platform-includes/crons/setup/go.mdx @@ -95,7 +95,7 @@ If you schedule jobs with [gocron v2](https://github.com/go-co-op/gocron) (v2.22 go get github.com/getsentry/sentry-go/gocron ``` -Pass `sentrygocron.NewSchedulerMonitor` to `gocron.WithSchedulerMonitor` to monitor every job. Each job name becomes a monitor slug, and cron and duration jobs use their schedule and the scheduler's location as the monitor schedule and timezone. Check-ins go to the client carried by the context, or the global client: +Pass `sentrygocron.NewSchedulerMonitor` to `gocron.WithSchedulerMonitor` to monitor every job. Each job name becomes a monitor slug, and each job's schedule and the scheduler's location become the monitor schedule and timezone. Check-ins go to the client carried by the context, or the global client: ```go import ( @@ -117,7 +117,7 @@ s, err := gocron.NewScheduler( s.NewJob(gocron.CronJob("0 * * * *", false), gocron.NewTask(task), gocron.WithName("")) ``` -Name your jobs with `gocron.WithName`. Jobs running an anonymous function without a name, and jobs sharing a name, aren't monitored. `Exclude` skips jobs by exact name, and `ExcludePatterns` by regular expression. Daily, weekly, monthly, random and one-time jobs, and schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds), aren't monitored. The gocron integration ships in the next release of `sentry-go`. +Name your jobs with `gocron.WithName`. Jobs running an anonymous function without a name, and jobs sharing a name, aren't monitored. `Exclude` skips jobs by exact name, and `ExcludePatterns` by regular expression. Random and one-time jobs, and schedules that can't be expressed in the Crons schedule format, aren't monitored. For example, a job that runs every 10 seconds, every 2 days, or on the last day of the month. The gocron integration ships in the next release of `sentry-go`. ### Manual Check-Ins