-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Check-In Upserts #3330
feat: Check-In Upserts #3330
Conversation
|
This reads like an old C# API and seems very ackward to me. Why do we need an email for owner? I imagine that's optional? Since we use the DSN the cron job gets tied to a project which has a team/owner already. Consider what's required value, and what's optional. But finally, my understanding of upset was that it would take the same API we use to make a normal check-in. Can we figure out interval through that? The key feature/ask here is that I don't need to create something upfront. It'll take a new check-in it'll create a monitor for it. Maybe it requires a few check-ins to figure out the interval this job is running at before it can start alerting if check-ins are failing. cc @gaprl does it do that by any chance? If we need some full blown API to create the cron job, do we run that once each time the app starts? If so, should that be on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, I think we need to add some more argument validation to ensure users can only configure crontab values that Sentry will accept but otherwise looking good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking very near ready. See my comment/question about whether we need the two overloads and/or I'd recommend we use a source generated regex in net8.0 if we do retain both overloads.
src/Sentry/SentryMonitorOptions.cs
Outdated
private readonly Regex _crontabValidation = new( | ||
@"^(\*|([0-5]?\d))(\s+)(\*|([01]?\d|2[0-3]))(\s+)(\*|([1-9]|[12]\d|3[01]))(\s+)(\*|([1-9]|1[0-2]))(\s+)(\*|([0-7]))$", | ||
RegexOptions.Compiled | RegexOptions.CultureInvariant); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On .NET 8 we could use Source Generated regular expressions for better performance.
We do this for the BuiltInSystemDiagnosticsMeters, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just the source generators for regex, if you feel like making it as performant as possible.
/// <summary> | ||
/// A tz database string representing the timezone which the monitor's execution schedule is in (i.e. "America/Los_Angeles"). | ||
/// </summary> | ||
public string? Timezone { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC I raised this before but it's TimeZone
: not Timezone: https://learn.microsoft.com/en-us/dotnet/api/system.timezone?view=net-8.0
2 words: time zone
Using this would look like this
I wish I could use
TimeZoneInfo
but Windows has its own thing going on and supports IANA Timezone IDs out of the box starting with .NET 6 (source)Checking with the other SDKs I don't really see the reason to build our own timezone converter for .NET 5 and older if the user has to specify via
string
which timezone anyway.