From 4a27afe173e07ef20c680dc730e62ab08b4288cd Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 2 Oct 2026 12:43:17 -0700 Subject: [PATCH 1/6] docs(crons): Lead .NET check-ins with SentrySdk.WithMonitor Co-Authored-By: Claude Opus 5.5 --- platform-includes/crons/setup/dotnet.mdx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/platform-includes/crons/setup/dotnet.mdx b/platform-includes/crons/setup/dotnet.mdx index 7f3b03b878d5a7..6d1fed905f7120 100644 --- a/platform-includes/crons/setup/dotnet.mdx +++ b/platform-includes/crons/setup/dotnet.mdx @@ -2,7 +2,29 @@ Check-in monitoring allows you to track a job's progress by completing two check-ins: one at the start of your job and another at the end of your job. This two-step process allows Sentry to notify you if your job didn't start when expected (missed) or if it exceeded its maximum runtime (failed). -Pass monitor options with the in-progress check-in so Sentry creates or updates the monitor from your code: +Wrap your job with `SentrySdk.WithMonitor`. It sends an in-progress check-in with the monitor options, which creates or updates the monitor, then runs the job and sends an ok or error check-in with its duration: + +```csharp +await SentrySdk.WithMonitor("", async () => +{ + // Execute your scheduled task here... +}, options => options.Interval("0 * * * *")); +``` + +For synchronous jobs, pass an `Action` or `Func` instead: + +```csharp +SentrySdk.WithMonitor("", () => +{ + // Execute your scheduled task here... +}, options => options.Interval("0 * * * *")); +``` + +Exceptions thrown by the job are rethrown, and the job's return value is passed through. `SentrySdk.WithMonitor` requires a Sentry .NET SDK version newer than `6.12.0`. If the monitor already exists in Sentry, you can leave out the monitor options. + +### Manual Check-Ins + +To send check-ins yourself, call `SentrySdk.CaptureCheckIn` at the start and end of your job. Pass monitor options with the in-progress check-in so Sentry creates or updates the monitor from your code: ```csharp // 🟡 Notify Sentry your job is running: From 81f84c61b4adb97f1a1f94455d1350c65b9e2cb9 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Mon, 5 Oct 2026 12:00:44 -0700 Subject: [PATCH 2/6] docs(dotnet): note how to monitor ValueTask jobs with WithMonitor Co-Authored-By: Claude --- platform-includes/crons/setup/dotnet.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform-includes/crons/setup/dotnet.mdx b/platform-includes/crons/setup/dotnet.mdx index 6d1fed905f7120..452cafaf3efaaa 100644 --- a/platform-includes/crons/setup/dotnet.mdx +++ b/platform-includes/crons/setup/dotnet.mdx @@ -11,6 +11,8 @@ await SentrySdk.WithMonitor("", async () => }, options => options.Interval("0 * * * *")); ``` +If your job returns a `ValueTask`, pass `async () => await RunJobAsync()` so the check-in waits for the job to finish. + For synchronous jobs, pass an `Action` or `Func` instead: ```csharp From bf111b653ac2b36817d4eda92e411c19ffb79478 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Mon, 5 Oct 2026 12:18:27 -0700 Subject: [PATCH 3/6] docs(crons): Note that each .NET WithMonitor run gets its own trace Co-Authored-By: Claude --- platform-includes/crons/setup/dotnet.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/crons/setup/dotnet.mdx b/platform-includes/crons/setup/dotnet.mdx index 452cafaf3efaaa..fdd5d0a7184d53 100644 --- a/platform-includes/crons/setup/dotnet.mdx +++ b/platform-includes/crons/setup/dotnet.mdx @@ -22,7 +22,7 @@ SentrySdk.WithMonitor("", () => }, options => options.Interval("0 * * * *")); ``` -Exceptions thrown by the job are rethrown, and the job's return value is passed through. `SentrySdk.WithMonitor` requires a Sentry .NET SDK version newer than `6.12.0`. If the monitor already exists in Sentry, you can leave out the monitor options. +Exceptions thrown by the job are rethrown, and the job's return value is passed through. Each run gets its own trace, shared by its check-ins and any errors captured during the run, unless a transaction or span is already active. `SentrySdk.WithMonitor` requires a Sentry .NET SDK version newer than `6.12.0`. If the monitor already exists in Sentry, you can leave out the monitor options. ### Manual Check-Ins From 1e03d2aa95a66dcace86f6bfe75b39dad97b0236 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Mon, 5 Oct 2026 17:45:26 -0700 Subject: [PATCH 4/6] docs(crons): List .NET and Hangfire on the crons setup page Co-Authored-By: Claude --- .../monitors/crons/getting-started/index.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/product/monitors-and-alerts/monitors/crons/getting-started/index.mdx b/docs/product/monitors-and-alerts/monitors/crons/getting-started/index.mdx index 6fed649bd82402..6d82517bcf7dc0 100644 --- a/docs/product/monitors-and-alerts/monitors/crons/getting-started/index.mdx +++ b/docs/product/monitors-and-alerts/monitors/crons/getting-started/index.mdx @@ -21,6 +21,8 @@ To set up Sentry Crons, use the links below for supported SDKs or the Sentry CLI - [Go](/platforms/go/crons/) - [Java](/platforms/java/crons/) - [Spring Boot](/platforms/java/guides/spring-boot/crons/) +- [.NET](/platforms/dotnet/crons/) + - [Hangfire](/platforms/dotnet/crons/hangfire/) - [Ruby](/platforms/ruby/crons/) - [Elixir](/platforms/elixir/crons/) From e619eac43bf424add2d8082dbb2784689316b7c6 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 13 Oct 2026 12:04:57 -0700 Subject: [PATCH 5/6] docs(crons): Use WithMonitorAsync for async .NET jobs --- platform-includes/crons/setup/dotnet.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform-includes/crons/setup/dotnet.mdx b/platform-includes/crons/setup/dotnet.mdx index fdd5d0a7184d53..cce60f5431d9df 100644 --- a/platform-includes/crons/setup/dotnet.mdx +++ b/platform-includes/crons/setup/dotnet.mdx @@ -2,18 +2,18 @@ Check-in monitoring allows you to track a job's progress by completing two check-ins: one at the start of your job and another at the end of your job. This two-step process allows Sentry to notify you if your job didn't start when expected (missed) or if it exceeded its maximum runtime (failed). -Wrap your job with `SentrySdk.WithMonitor`. It sends an in-progress check-in with the monitor options, which creates or updates the monitor, then runs the job and sends an ok or error check-in with its duration: +Wrap your job with `SentrySdk.WithMonitorAsync`. It sends an in-progress check-in with the monitor options, which creates or updates the monitor, then runs the job and sends an ok or error check-in with its duration: ```csharp -await SentrySdk.WithMonitor("", async () => +await SentrySdk.WithMonitorAsync("", async () => { // Execute your scheduled task here... }, options => options.Interval("0 * * * *")); ``` -If your job returns a `ValueTask`, pass `async () => await RunJobAsync()` so the check-in waits for the job to finish. +If your job returns a `ValueTask` or `ValueTask`, pass `async () => await RunJobAsync()`. -For synchronous jobs, pass an `Action` or `Func` instead: +For synchronous jobs, use `SentrySdk.WithMonitor`: ```csharp SentrySdk.WithMonitor("", () => @@ -22,7 +22,7 @@ SentrySdk.WithMonitor("", () => }, options => options.Interval("0 * * * *")); ``` -Exceptions thrown by the job are rethrown, and the job's return value is passed through. Each run gets its own trace, shared by its check-ins and any errors captured during the run, unless a transaction or span is already active. `SentrySdk.WithMonitor` requires a Sentry .NET SDK version newer than `6.12.0`. If the monitor already exists in Sentry, you can leave out the monitor options. +Exceptions thrown by the job are rethrown, and the job's return value is passed through. Each run gets its own trace, shared by its check-ins and any errors captured during the run, unless a transaction or span is already active. `SentrySdk.WithMonitor` and `SentrySdk.WithMonitorAsync` require a Sentry .NET SDK version newer than `6.12.0`. If the monitor already exists in Sentry, you can leave out the monitor options. ### Manual Check-Ins From e6d5a015453726e6373779eaa5e27f0a76548c25 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 15 Oct 2026 10:19:12 +1300 Subject: [PATCH 6/6] Apply batched suggestions from code review Co-authored-by: Ricardo Colombo Oliveira --- platform-includes/crons/setup/dotnet.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform-includes/crons/setup/dotnet.mdx b/platform-includes/crons/setup/dotnet.mdx index cce60f5431d9df..5d89515795100e 100644 --- a/platform-includes/crons/setup/dotnet.mdx +++ b/platform-includes/crons/setup/dotnet.mdx @@ -22,7 +22,9 @@ SentrySdk.WithMonitor("", () => }, options => options.Interval("0 * * * *")); ``` -Exceptions thrown by the job are rethrown, and the job's return value is passed through. Each run gets its own trace, shared by its check-ins and any errors captured during the run, unless a transaction or span is already active. `SentrySdk.WithMonitor` and `SentrySdk.WithMonitorAsync` require a Sentry .NET SDK version newer than `6.12.0`. If the monitor already exists in Sentry, you can leave out the monitor options. +Exceptions thrown by the job are rethrown, and the job's return value is passed through. Each run gets its own trace, shared by its check-ins and any errors captured during the run, unless a transaction or span is already active. `SentrySdk.WithMonitor` and `SentrySdk.WithMonitorAsync` require a Sentry .NET SDK version newer than `6.12.1`. If the monitor already exists in Sentry, you can leave out the monitor options. + +See [Upserting Cron Monitors](#upserting-cron-monitors) for all configuration options. ### Manual Check-Ins