getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
574 stars 205 forks source link

Support for Crons on Hangfire #2239

Closed bruno-garcia closed 4 months ago

bruno-garcia commented 1 year ago

Problem Statement

Crons is in Beta: https://docs.sentry.io/product/crons/

Other SDKs:

Solution Brainstorm

Spec is pending, this can be on hold until then.

@kanadaj already created something for Hangfire (and Quartz) that can be brought in or used as inspiration: https://github.com/kanadaj/Sentry.Monitor

mattjohnsonpint commented 1 year ago

Hangfire is mostly about fire-and-forget background tasks. We'd be mostly interested their recurrent tasks feature. https://docs.hangfire.io/en/latest/background-methods/performing-recurrent-tasks.html

We should also look at Quartz.NET, which is primarily aimed at scheduling.

Also, there are several cloud-based schedulers offered by Azure, AWS & GCP - but I think those should be broader initiatives, not specific for .NET.

mattjohnsonpint commented 1 year ago

Note, this issue mirrors https://github.com/getsentry/sentry/issues/44377

mattjohnsonpint commented 1 year ago

Also, this has already been started externally, by @kanadaj at https://github.com/kanadaj/Sentry.Monitor

bruno-garcia commented 1 year ago

I use it as a recurring job runner on: https://github.com/dotnet/nuget-trends and plan to dogfood there

bruno-garcia commented 1 year ago

Deleted Quartz from the title. Lets scope this to Hangfire only. if there's demand for Quartz we can create another issue and track separately.

kanadaj commented 1 year ago

@bruno-garcia My implementation already has both Quartz and Hangfire and seems to work fine unless the API changes for some reason.

bruno-garcia commented 1 year ago

@bruno-garcia My implementation already has both Quartz and Hangfire and seems to work fine unless the API changes for some reason.

Edited the title to note that your code has both and we can talk about moving it in to this repo 🙏 Thanks!

kanadaj commented 1 year ago

This was discussed on Discord, but for recordkeeping: if we want to make these more generic libraries (Sentry.Hangfire and Sentry.Quartz) we'd probably want to also add facilities for tracing the jobs. This could be done for non-recurring jobs too.

bruno-garcia commented 7 months ago

Related to Crons (but not Hangfire, an alternative): https://www.nuget.org/packages/ncrontab

pinkpawkitty commented 5 months ago

Deleted Quartz from the title. Lets scope this to Hangfire only. if there's demand for Quartz we can create another issue and track separately.

For reference, I'd love to have an implementation for Quartz.

bruno-garcia commented 5 months ago

Deleted Quartz from the title. Lets scope this to Hangfire only. if there's demand for Quartz we can create another issue and track separately.

For reference, I'd love to have an implementation for Quartz.