getsentry / sentry-dotnet

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

.NET crontab syntax for every 2nd hour doesn't work #3719

Open tobiasosterblom opened 3 weeks ago

tobiasosterblom commented 3 weeks ago

Package

Sentry

.NET Flavor

.NET

.NET Version

8

OS

Windows

SDK Version

4.12.1

Self-Hosted Sentry Version

24.10.0

Steps to Reproduce

When using the API to set interval we aren't allowed to use the syntax for every 2nd hour (0 */2 * * *). Alltough when we are entering this in the web-UI it seems to be allowed (and the tooltip displays the correct interpretation). Image

Expected Result

To be allowed to use the SetInterval method with a slash / sign to be able to configure the cron programmatically . E.g.

        private void ConfigureOptions(SentryMonitorOptions options)
        {
            options.Interval("0 */2 * * *"); // <-- this throws an error
            options.CheckInMargin = TimeSpan.FromMinutes(10);
            options.FailureIssueThreshold = 1;
        }

Actual Result

Exception: System.ArgumentException: 'The provided crontab does not match the expected format of '* * * * *' translating to 'minute', 'hour', 'day of the month', 'month', and 'day of the week'.'

I suspect that the regex needs some tweaking here.

bruno-garcia commented 3 weeks ago

@bitsandfoxes any tips here on the crons side?