Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
350f039
feat: add Sentry.Quartz
michaelmairegger Oct 6, 2025
be40ccc
refactor: optimize cron information retrieval in SentryCronJobListener
michaelmairegger Oct 7, 2025
ed08560
refactor: swap ILogger dependency from SentryCronJobListener with IDi…
michaelmairegger Oct 7, 2025
5b0911c
refactor: simplify Quartz configuration by removing redundant service…
michaelmairegger Oct 7, 2025
7927c33
refactor: migrate to Quartz v4.0.0 with .NET 10
michaelmairegger Aug 24, 2026
6545156
feat: include Sentry.Quartz in solution filter and generation scripts
michaelmairegger Aug 24, 2026
864de52
feat: add Quartz sample showcasing Sentry integration
michaelmairegger Aug 24, 2026
77ad99a
fix: cursor github comments
michaelmairegger Aug 24, 2026
489d073
refactor: simplify Quartz configuration and update project to use Web…
michaelmairegger Aug 24, 2026
5c2c060
refactor: replace SentryCronJobListener with SentryCronJobMiddleware …
michaelmairegger Aug 31, 2026
e1def11
fix: handling issue where current region might throw a CultureNotFoun…
michaelmairegger Aug 31, 2026
e8669e8
fix: sample project has different nuget package version
michaelmairegger Aug 31, 2026
b30f97a
fix: skip middleware execution for non-cron triggers
michaelmairegger Sep 1, 2026
9c7f36e
refactor: rename and update Quartz extension method to AddSentryCronJob
michaelmairegger Sep 1, 2026
c882dc0
feat: add SentryMetricsMiddleware to track Quartz job execution durat…
michaelmairegger Sep 1, 2026
65fc9ab
refactor: simplify AddSentryCronJob method by removing unused service…
michaelmairegger Sep 1, 2026
d1082e7
feat: add SentryScopeMiddleware and extend Quartz integration with Ad…
michaelmairegger Sep 1, 2026
e32a27e
refactor: move non-cron trigger check to StartQuartz method
michaelmairegger Sep 1, 2026
25d22a7
feat: add missing options parameter
michaelmairegger Sep 1, 2026
2718a74
refactor: remove unused project reference to Sentry.AspNetCore in Sen…
michaelmairegger Sep 1, 2026
1d13fd2
fix: Quatz.Net and Sentry handling cron expression for days differently
michaelmairegger Sep 1, 2026
7f0a48a
feat: add XML documenation
michaelmairegger Sep 7, 2026
6a91e70
feat: update Quartz to stable v4.0.0
michaelmairegger Sep 7, 2026
202c475
feat: add Quartz Dashboard and HTTP API integration, update launch URL
michaelmairegger Sep 7, 2026
8278009
feat: add customizable SentryMonitorOptions via callback
michaelmairegger Sep 7, 2026
83e92d2
style: apply dotnet format to Sentry.Quartz
jamescrosswell Sep 8, 2026
045f8d9
ci(craft): add Sentry.Quartz to the release registry
jamescrosswell Sep 8, 2026
be3fe21
test: add Sentry.Quartz.Tests
michaelmairegger Sep 8, 2026
16792a1
feat: add configurable SentryScopeMiddleware options
michaelmairegger Sep 14, 2026
0f8e237
refactor: migrate extension methods to extension block
michaelmairegger Sep 14, 2026
f0eebaf
refactor: remove SentryMetricsMiddleware
michaelmairegger Sep 14, 2026
1b46d8b
fix: use JobDetail.Key.ToString()
michaelmairegger Sep 14, 2026
15b62bb
fix: replace job type with job ID in SentryCronJobMiddleware dictiona…
michaelmairegger Sep 14, 2026
8a765b2
feat(quartz): Rework Sentry.Quartz into Sentry.Quartz4
wedamija Oct 6, 2026
fd4beb4
ref(quartz): Rename Sentry.Quartz4 to Sentry.Quartz
wedamija Oct 6, 2026
739ce97
fix(quartz): Address review feedback on Sentry.Quartz
wedamija Oct 8, 2026
e589241
feat(quartz): Add Sentry.Quartz3 for Quartz.NET 3.x
wedamija Oct 8, 2026
37ac6e2
fix(quartz): Apply the Sentry.Quartz review fixes to Sentry.Quartz3
wedamija Oct 8, 2026
fe97276
ref(quartz): Drop warn-once state and discard options from a failed c…
wedamija Oct 8, 2026
4409f98
Merge danf/quartz-5505-rebased into danf/quartz-crons
wedamija Oct 8, 2026
73e5551
fix(quartz): Capture job exceptions in the job scope and rename the s…
wedamija Oct 13, 2026
573aa7e
Merge remote-tracking branch 'origin/danf/quartz-5505-rebased' into d…
wedamija Oct 13, 2026
d7471ef
ref(quartz): Rename SentryCronMonitorSlug to SentryMonitorSlug in Sen…
wedamija Oct 13, 2026
9bdfed5
test(quartz): Reorder the Sentry.Quartz3 API snapshots after the attr…
wedamija Oct 13, 2026
ccf6da4
docs(quartz): Say that AddSentry captures job exceptions
jamescrosswell Oct 15, 2026
6bb5320
Merge branch 'main' into feature/sentry.quartz
wedamija Oct 19, 2026
e957e7b
ref(quartz): Remove a leftover comment from JobMonitor
wedamija Oct 20, 2026
787ab1e
fix(quartz): Drop the schedule when jobs share a slug with different …
wedamija Oct 20, 2026
ef8b0e6
test(quartz): Skip the time zone test when there's no time zone database
wedamija Oct 20, 2026
b59c8d9
docs(quartz): Drop the stale warning from the slug attribute docs
jamescrosswell Oct 20, 2026
6c73800
Merge branch 'main' into feature/sentry.quartz
jamescrosswell Oct 21, 2026
5cd8de3
Merge remote-tracking branch 'origin/danf/quartz-5505-rebased' into HEAD
wedamija Oct 21, 2026
db76158
Merge branch 'danf/quartz-5505-rebased' into danf/quartz-crons
wedamija Oct 21, 2026
edc9757
fix(quartz): Skip jobs whose type can't be resolved when reading trig…
wedamija Oct 21, 2026
e892565
test(quartz): Pin the order of the Sentry job middleware
wedamija Oct 21, 2026
0b3b755
docs(quartz): Update the sample's comment on how job exceptions are c…
wedamija Oct 21, 2026
a46a523
test(quartz): Fix the nullability of the Quartz 3 job detail stub
wedamija Oct 21, 2026
f5ff141
test(quartz): Ignore the nullability of the Quartz 3 job detail stub
wedamija Oct 21, 2026
1383e8a
fix(quartz): Capture each job exception once with the logging integra…
wedamija Oct 21, 2026
6bbad5e
Merge branch 'danf/quartz-5505-rebased' into danf/quartz-crons
wedamija Oct 21, 2026
3a84027
test(quartz): Check that AddSentry leaves unrelated options resolvable
wedamija Oct 21, 2026
8d47b98
Merge branch 'danf/quartz-5505-rebased' into danf/quartz-crons
wedamija Oct 21, 2026
81e1888
Update src/Sentry.Quartz/QuartzErrorLogFilterSetup.cs
wedamija Oct 21, 2026
f3d7c36
ref(quartz): Drop the stale constraint wording and assertion for the …
wedamija Oct 21, 2026
4a8c9a5
Merge branch 'danf/quartz-5505-rebased' into danf/quartz-crons
wedamija Oct 21, 2026
4b670aa
Merge branch 'main' into danf/quartz-crons
wedamija Oct 21, 2026
8bbedae
Merge remote-tracking branch 'origin/main' into HEAD
wedamija Oct 29, 2026
340bc6c
fix(quartz3): Send an error check-in when a job is cancelled
wedamija Oct 29, 2026
b3446f4
test(quartz): Only run the IANA time zone test on .NET 6+
wedamija Oct 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,7 @@ targets:
name: Sentry.Quartz
packageUrl: https://www.nuget.org/packages/Sentry.Quartz
mainDocsUrl: https://docs.sentry.io/platforms/dotnet/crons/quartz/
nuget:Sentry.Quartz3:
name: Sentry.Quartz3
packageUrl: https://www.nuget.org/packages/Sentry.Quartz3
mainDocsUrl: https://docs.sentry.io/platforms/dotnet/crons/quartz/
2 changes: 2 additions & 0 deletions .generated.NoMobile.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<Project Path="src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj" />
<Project Path="src/Sentry.Profiling/Sentry.Profiling.csproj" />
<Project Path="src/Sentry.Quartz/Sentry.Quartz.csproj" />
<Project Path="src/Sentry.Quartz3/Sentry.Quartz3.csproj" />
<Project Path="src/Sentry.Serilog/Sentry.Serilog.csproj" />
<Project Path="src/Sentry/Sentry.csproj" />
</Folder>
Expand Down Expand Up @@ -203,6 +204,7 @@
<Project Path="test/Sentry.OpenTelemetry.Tests/Sentry.OpenTelemetry.Tests.csproj" />
<Project Path="test/Sentry.Profiling.Tests/Sentry.Profiling.Tests.csproj" />
<Project Path="test/Sentry.Quartz.Tests/Sentry.Quartz.Tests.csproj" />
<Project Path="test/Sentry.Quartz3.Tests/Sentry.Quartz3.Tests.csproj" />
<Project Path="test/Sentry.Serilog.Tests/Sentry.Serilog.Tests.csproj" />
<Project Path="test/Sentry.Testing.CrashableApp/Sentry.Testing.CrashableApp.csproj" />
<Project Path="test/Sentry.Testing/Sentry.Testing.csproj" />
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body:
- Sentry.OpenTelemetry
- Sentry.Profiling
- Sentry.Quartz
- Sentry.Quartz3
- Sentry.Serilog
- Other
validations:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ Sentry SDK for .NET
| **Sentry.OpenTelemetry.Exporter** | [![Downloads](https://img.shields.io/nuget/dt/Sentry.OpenTelemetry.Exporter.svg)](https://www.nuget.org/packages/Sentry.OpenTelemetry.Exporter) | [![NuGet](https://img.shields.io/nuget/v/Sentry.OpenTelemetry.Exporter.svg)](https://www.nuget.org/packages/Sentry.OpenTelemetry.Exporter) | [![NuGet](https://img.shields.io/nuget/vpre/Sentry.OpenTelemetry.Exporter.svg)](https://www.nuget.org/packages/Sentry.OpenTelemetry.Exporter) | [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/dotnet/tracing/instrumentation/opentelemetry-otlp/) |
| **Sentry.Profiling** | [![Downloads](https://img.shields.io/nuget/dt/Sentry.Profiling.svg)](https://www.nuget.org/packages/Sentry.Profiling) | [![NuGet](https://img.shields.io/nuget/v/Sentry.Profiling.svg)](https://www.nuget.org/packages/Sentry.Profiling) | [![NuGet](https://img.shields.io/nuget/vpre/Sentry.Profiling.svg)](https://www.nuget.org/packages/Sentry.Profiling) | [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/dotnet/profiling/) |
| **Sentry.Quartz** | [![Downloads](https://img.shields.io/nuget/dt/Sentry.Quartz.svg)](https://www.nuget.org/packages/Sentry.Quartz) | [![NuGet](https://img.shields.io/nuget/v/Sentry.Quartz.svg)](https://www.nuget.org/packages/Sentry.Quartz) | [![NuGet](https://img.shields.io/nuget/vpre/Sentry.Quartz.svg)](https://www.nuget.org/packages/Sentry.Quartz) | [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/dotnet/crons/quartz/) |
| **Sentry.Quartz3** | [![Downloads](https://img.shields.io/nuget/dt/Sentry.Quartz3.svg)](https://www.nuget.org/packages/Sentry.Quartz3) | [![NuGet](https://img.shields.io/nuget/v/Sentry.Quartz3.svg)](https://www.nuget.org/packages/Sentry.Quartz3) | [![NuGet](https://img.shields.io/nuget/vpre/Sentry.Quartz3.svg)](https://www.nuget.org/packages/Sentry.Quartz3) | [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/dotnet/crons/quartz/) |
| **Sentry.Serilog** | [![Downloads](https://img.shields.io/nuget/dt/Sentry.Serilog.svg)](https://www.nuget.org/packages/Serilog) | [![NuGet](https://img.shields.io/nuget/v/Sentry.Serilog.svg)](https://www.nuget.org/packages/Sentry.Serilog) | [![NuGet](https://img.shields.io/nuget/vpre/Sentry.Serilog.svg)](https://www.nuget.org/packages/Sentry.Serilog) | [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/dotnet/guides/serilog) |

Use Sentry.Quartz3 with Quartz.NET 3.x (3.6.0 or later) and Sentry.Quartz with Quartz.NET 4.x.

## More Sentry .NET Integrations

Sentry offers other integrations that are not part of this repository:
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Linux-NoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand All @@ -73,6 +74,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Linux.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand All @@ -80,6 +81,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Windows-arm64.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand All @@ -80,6 +81,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-Windows.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand All @@ -83,6 +84,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
2 changes: 2 additions & 0 deletions Sentry-CI-Build-macOS.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand All @@ -84,6 +85,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-CodeQL.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj"
]
Expand Down
2 changes: 2 additions & 0 deletions Sentry.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<Project Path="src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj" />
<Project Path="src/Sentry.Profiling/Sentry.Profiling.csproj" />
<Project Path="src/Sentry.Quartz/Sentry.Quartz.csproj" />
<Project Path="src/Sentry.Quartz3/Sentry.Quartz3.csproj" />
<Project Path="src/Sentry.Serilog/Sentry.Serilog.csproj" />
<Project Path="src/Sentry/Sentry.csproj" />
</Folder>
Expand Down Expand Up @@ -203,6 +204,7 @@
<Project Path="test/Sentry.OpenTelemetry.Tests/Sentry.OpenTelemetry.Tests.csproj" />
<Project Path="test/Sentry.Profiling.Tests/Sentry.Profiling.Tests.csproj" />
<Project Path="test/Sentry.Quartz.Tests/Sentry.Quartz.Tests.csproj" />
<Project Path="test/Sentry.Quartz3.Tests/Sentry.Quartz3.Tests.csproj" />
<Project Path="test/Sentry.Serilog.Tests/Sentry.Serilog.Tests.csproj" />
<Project Path="test/Sentry.Testing.CrashableApp/Sentry.Testing.CrashableApp.csproj" />
<Project Path="test/Sentry.Testing/Sentry.Testing.csproj" />
Expand Down
1 change: 1 addition & 0 deletions SentryAspNetCore.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"src\\Sentry.Hangfire\\Sentry.Hangfire.csproj",
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand Down
2 changes: 2 additions & 0 deletions SentryNoMobile.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand All @@ -78,6 +79,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
2 changes: 2 additions & 0 deletions SentryNoSamples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
"src\\Sentry.Quartz\\Sentry.Quartz.csproj",
"src\\Sentry.Quartz3\\Sentry.Quartz3.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
Expand Down Expand Up @@ -52,6 +53,7 @@
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
"test\\Sentry.Quartz.Tests\\Sentry.Quartz.Tests.csproj",
"test\\Sentry.Quartz3.Tests\\Sentry.Quartz3.Tests.csproj",
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
"test\\Sentry.Testing\\Sentry.Testing.csproj",
Expand Down
1 change: 1 addition & 0 deletions scripts/generate-solution-filters-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ filterConfigs:
- "**/Sentry.Analyzers.csproj"
- "**/Sentry.Hangfire.csproj"
- "**/Sentry.Quartz.csproj"
- "**/Sentry.Quartz3.csproj"
- "**/Sentry.Samples.Hangfire.csproj"
- "**/Sentry.Testing.csproj"
- "**/Sentry.Testing.CrashableApp.csproj"
Expand Down
40 changes: 40 additions & 0 deletions src/Sentry.Quartz3/QuartzApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Quartz;
using Quartz.Impl.Matchers;

namespace Sentry.Quartz;

// The Quartz 3 side of the APIs that differ between Quartz 3 and 4
internal static class QuartzApi
{
// Quartz 3 needs exactly one day field to be '?', and the other decides
public static bool UnionsDayFields => false;

public static Type GetJobType(IJobDetail jobDetail) => jobDetail.JobType;

// Returns the triggers of every job that matches the predicate. Quartz 3 has no bulk lookups, so this reads each
// job, and the triggers of each matching one.
public static async Task<List<(IJobDetail Job, ITrigger Trigger)>> GetTriggersAsync(
IScheduler scheduler,
Func<IJobDetail, bool> predicate,
CancellationToken cancellationToken)
{
var result = new List<(IJobDetail Job, ITrigger Trigger)>();
var jobKeys = await scheduler.GetJobKeys(GroupMatcher<JobKey>.AnyGroup(), cancellationToken).ConfigureAwait(false);
foreach (var jobKey in jobKeys)
{
// Null when the job was deleted after its key was read
var job = await scheduler.GetJobDetail(jobKey, cancellationToken).ConfigureAwait(false);
if (job is null || !predicate(job))
{
continue;
}

foreach (var trigger in await scheduler.GetTriggersOfJob(jobKey, cancellationToken).ConfigureAwait(false))
{
result.Add((job, trigger));
}
}

return result;
}
}
29 changes: 29 additions & 0 deletions src/Sentry.Quartz3/Sentry.Quartz3.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Official Quartz.NET 3.x integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.</Description>
<PackageTags>$(PackageTags);Quartz;Crons</PackageTags>
<TargetFrameworks>$(CurrentTfms);net462</TargetFrameworks>
<RootNamespace>Sentry.Quartz</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(EnableAot)' == 'true'">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<!-- Shared with Sentry.Quartz. Only the hooks and the APIs that differ are version-specific. -->
<ItemGroup>
<Compile Include="..\Sentry.Quartz\Core\**\*.cs" Link="Core\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Sentry\Sentry.csproj" />
<!-- Quartz 4.x changed IJobListener to return ValueTask. Use Sentry.Quartz for it. -->
<PackageReference Include="Quartz" Version="[3.6.0,4.0.0)" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Sentry.Quartz3.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>

</Project>
79 changes: 79 additions & 0 deletions src/Sentry.Quartz3/SentryJobListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Quartz;
using Sentry.Extensibility;

namespace Sentry.Quartz;

/// <summary>
/// A Quartz.NET job listener that sends a Sentry check-in each time a job with
/// <see cref="SentryMonitorSlugAttribute"/> runs.
/// </summary>
public class SentryJobListener : IJobListener
{
// Keyed on the context, which Quartz passes to both callbacks of a run
private readonly ConditionalWeakTable<IJobExecutionContext, JobCheckIn> _checkIns = new();
private readonly JobMonitor _monitor;

/// <summary>
/// Creates a listener with the default options.
/// </summary>
public SentryJobListener() : this(new SentryQuartzOptions())
{
}

/// <summary>
/// Creates a listener with the given options.
/// </summary>
/// <param name="options">The options.</param>
public SentryJobListener(SentryQuartzOptions options) : this(options, HubAdapter.Instance)
{
}

internal SentryJobListener(SentryQuartzOptions options, IHub hub, IDiagnosticLogger? logger = null)
{
_monitor = new JobMonitor(options, hub, logger);

// Quartz 4 default-implements IJobListener with ValueTask methods, so ours would never be called
var quartzVersion = typeof(IJobListener).Assembly.GetName().Version;
if (IsUnsupportedQuartzVersion(quartzVersion))
{
_monitor.Logger?.LogError("Sentry.Quartz3 supports Quartz.NET 3.x, but Quartz.NET {0} is loaded, so no " +
"check-ins will be sent. Use the Sentry.Quartz package for Quartz.NET 4.x.", quartzVersion);
}
}

internal static bool IsUnsupportedQuartzVersion(Version? version) => version is { Major: >= 4 };

/// <inheritdoc />
public string Name => "Sentry";

/// <inheritdoc />
public async Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
{
if (await _monitor.StartAsync(context, cancellationToken).ConfigureAwait(false) is { } checkIn)
{
_checkIns.Remove(context);
_checkIns.Add(context, checkIn);
}
}

/// <inheritdoc />
public Task JobWasExecuted(
IJobExecutionContext context,
JobExecutionException? jobException,
CancellationToken cancellationToken = default)
{
if (_checkIns.TryGetValue(context, out var checkIn))
{
_checkIns.Remove(context);
// Quartz swallows a cancelled job's OperationCanceledException and passes no exception here
_monitor.Finish(checkIn, failed: jobException is not null || context.CancellationToken.IsCancellationRequested,
context.JobRunTime);
}

return Task.CompletedTask;
}

/// <inheritdoc />
public Task JobExecutionVetoed(IJobExecutionContext context, CancellationToken cancellationToken = default) =>
Task.CompletedTask;
}
2 changes: 2 additions & 0 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@
<InternalsVisibleTo Include="Sentry.Profiling.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Quartz" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Quartz.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Quartz3" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Quartz3.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Serilog" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Serilog.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Testing" PublicKey="$(SentryPublicKey)" />
Expand Down
Loading
Loading