
Sentry Dotnet Sdk
Instrument .NET background jobs and crons with Sentry check-ins so missed runs, failures, and timeouts surface in one monitor.
Install
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-dotnet-sdkWhat is this skill?
- Documents Sentry Cron Monitoring for missed check-ins, runtime failures, and MaxRuntime timeouts
- Two-signal pattern: InProgress at start, Ok or Error at end with correlated checkInId
- Simpler heartbeat single check-in pattern for lightweight jobs
- Requires Sentry SDK package version ≥ 4.2.0 for CaptureCheckIn API
Adoption & trust: 1.1k installs on skills.sh; 197 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Azure Deploymicrosoft/azure-skills
Azure Preparemicrosoft/azure-skills
Azure Storagemicrosoft/azure-skills
Azure Validatemicrosoft/azure-skills
Appinsights Instrumentationmicrosoft/azure-skills
Azure Resource Lookupmicrosoft/azure-skills
Journey fit
Primary fit
Cron monitoring and check-ins apply after code is in production, when reliability and alerting matter. The skill documents CaptureCheckIn and monitor slugs—canonical placement is production monitoring, not initial backend coding.
Common Questions / FAQ
Is Sentry Dotnet 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 Dotnet Sdk
# Crons — Sentry .NET SDK > Minimum SDK: `Sentry` ≥ 4.2.0 --- ## Overview Sentry Cron Monitoring detects: - **Missed check-ins** — job didn't run at the expected time - **Runtime failures** — job ran but encountered an error - **Timeouts** — job exceeded `MaxRuntime` without completing --- ## `CaptureCheckIn()` API ```csharp // Signature SentryId CaptureCheckIn( string monitorSlug, CheckInStatus status, SentryId? checkInId = null, TimeSpan? duration = null, Action<SentryMonitorOptions>? configureMonitorOptions = null ) ``` ### Check-In Status Values | Status | When to use | |--------|-------------| | `CheckInStatus.InProgress` | Job has started, work is underway | | `CheckInStatus.Ok` | Job completed successfully | | `CheckInStatus.Error` | Job failed — an error occurred | --- ## Pattern A: Two-Signal Check-Ins (Recommended) Sends two signals: `InProgress` at start and `Ok`/`Error` at end. Enables detection of both **missed jobs** and **timeout violations**. ```csharp // Mark job as started — save the checkInId for correlation var checkInId = SentrySdk.CaptureCheckIn("my-monitor-slug", CheckInStatus.InProgress); try { DoWork(); // Mark as successful SentrySdk.CaptureCheckIn("my-monitor-slug", CheckInStatus.Ok, checkInId); } catch (Exception ex) { // Mark as failed SentrySdk.CaptureCheckIn("my-monitor-slug", CheckInStatus.Error, checkInId); throw; } ``` --- ## Pattern B: Heartbeat Check-In (Simpler) Sends a single check-in **after** execution. Detects **missed jobs** only — cannot detect timeouts. ```csharp try { DoWork(); SentrySdk.CaptureCheckIn("my-monitor-slug", CheckInStatus.Ok); } catch { SentrySdk.CaptureCheckIn("my-monitor-slug", CheckInStatus.Error); throw; } ``` Optionally report the actual runtime duration: ```csharp var sw = Stopwatch.StartNew(); DoWork(); sw.Stop(); SentrySdk.CaptureCheckIn( "my-monitor-slug", CheckInStatus.Ok, duration: sw.Elapsed ); ``` --- ## Programmatic Monitor Configuration (Upsert) Create or update a monitor directly from code via `configureMonitorOptions`. This is sent with the **first** check-in and is idempotent — safe to call on every run. ### Crontab Schedule ```csharp var checkInId = SentrySdk.CaptureCheckIn( "my-scheduled-job", CheckInStatus.InProgress, configureMonitorOptions: options => { options.Schedule = "0 2 * * *"; // 2 AM daily (crontab expression) options.CheckInMargin = 5; // 5 min grace period before "missed" options.MaxRuntime = 30; // alert if running longer than 30 min options.TimeZone = "America/New_York"; // IANA timezone options.FailureIssueThreshold = 2; // create issue after 2 consecutive failures options.RecoveryThreshold = 1; // resolve issue after 1 consecutive success } ); ``` ### Interval-Based Schedule ```csharp var checkInId = SentrySdk.CaptureCheckIn( "my-interval-job", CheckInStatus.InProgress, configureMonitorOptions: options => { options.Interval(6, SentryMonitorInterval.Hour); // every 6 hours options.CheckInMargin = 30; options.MaxRuntime = 120; options.TimeZone = "UTC"; options.FailureIssueThreshold = 1; options.RecoveryThreshold = 3; } ); ``` ### `SentryMonitorInterval` Values | Value | Description | |-------|-------------| | `SentryMonitorInterval.Minute` | Per-minute interval | | `SentryMonitorInterval.Hour` | Per-hour interval | | `SentryMonitorInterval.Day` | Per-day interval | | `SentryMonitorInterval.Week` | Per-week interval | | `SentryMonitorInterval.Month` | Per-month interval | | `SentryMonitorInterval.Year` | Per-year interval | --- ## Monitor Configuration Reference | Option | Type | Description | |--------|------|-------------| | `Schedule` | `string` | Standard crontab expression (e.g., `"*/15 * * * *"`) | | `Interval(n, unit)` | method | Interval-based s