feat(incidents): Add a BROKEN state to QuerySubscription; include it in Detector APIs#115244
feat(incidents): Add a BROKEN state to QuerySubscription; include it in Detector APIs#115244
Conversation
| with transaction.atomic(router.db_for_write(QuerySubscription)): | ||
| subscription.update(status=QuerySubscription.Status.UPDATING.value) | ||
| subscription.update( | ||
| status=QuerySubscription.Status.UPDATING.value, date_updated=timezone.now() |
There was a problem hiding this comment.
possibly overkill but there is an auto_now=True field you can set on the django model
ceorourke
left a comment
There was a problem hiding this comment.
I really like this concept - though it would be great if we weren't even allowing the detectors to be created if the subscription couldn't be created. I know sometimes the query ages out and that just causes previously valid subscriptions to become invalid though. Maybe as a follow up we can tighten up the ones that are making it through creation that are failing. I'm curious as to how we'll surface the error messages to users in a helpful way.
Yeah, fixing our validation is some deep EAP stuff that also needs to happen for this to be actually useful. If you can submit the same broken query again, that's.. not great. I have a PR brewing for it, but I'm not sure I'll be able to see it through. |
Rather than trying continuously to create/update broken Snuba subscriptions, this introduces a 'BROKEN' state and adds methods to DataSourceHandler to allow the Detector APIs to indicate when the data source is broken.
This should allow us to make it clear in the UI that a particular Detector isn't in a good state, and potentially allow us to ask users to resolve the issue.