refs(subscriptions): Start using fields from snuba_query to replace fields on the alert rule#18751
Merged
Merged
Conversation
56a82c1 to
f3d9e90
Compare
snuba_query to replacefields on the alert rulesnuba_query to replace fields on the alert rule
f3d9e90 to
0507687
Compare
0507687 to
8f432be
Compare
wedamija
added a commit
that referenced
this pull request
May 13, 2020
…elds on the alert rule. This continues the work from #18751. This converts most of the fields in Sentry to use this new model. Will follow this up with a pr to remove the old fields.
iProgramStuff
suggested changes
May 13, 2020
|
|
||
| def serialize(self, obj, attrs, user): | ||
| env = obj.snuba_query.environment | ||
| aggregation = aggregate_to_query_aggregation.get(obj.snuba_query.aggregate).value |
Contributor
There was a problem hiding this comment.
I think this lookup will fail because with the new performance selector we will be saving aggregates we don't recognize.
Member
Author
There was a problem hiding this comment.
This will fail eventually, but currently there's no way to pass those string aggregates to the backend, so is fine for now. I'll tackle this once I start those api changes.
| "aggregate": self.query_aggregations_display[QueryAggregations(alert_rule.aggregation)], | ||
| "query": alert_rule.query, | ||
| "aggregate": self.query_aggregations_display[ | ||
| aggregate_to_query_aggregation[alert_rule.snuba_query.aggregate] |
Contributor
There was a problem hiding this comment.
Same concern here as we start writing the new aggregate.
| "subscription_resolution": subscription.resolution, | ||
| "subscription_dataset": subscription.snuba_query.dataset, | ||
| "subscription_query": subscription.snuba_query.query, | ||
| "subscription_aggregation": subscription.snuba_query.aggregate, |
Contributor
There was a problem hiding this comment.
This will now be a string instead of 0/1?
Member
Author
There was a problem hiding this comment.
That's fine, this is just logs. This is actually more descriptive
… fields on the alert rule This changes us to use fields on the `snuba_query` in more places. I'll do another pass at this after this pr and catch the rest that I missed. It's fine to read from these fields in either the snuba_query or alert_rule, since we're keeping the two in sync at the moment.
8f432be to
a6b7a7e
Compare
iProgramStuff
approved these changes
May 13, 2020
wedamija
added a commit
that referenced
this pull request
May 13, 2020
…elds on the alert rule. This continues the work from #18751. This converts most of the fields in Sentry to use this new model. Will follow this up with a pr to remove the old fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes us to use fields on the
snuba_queryin more places. I'll do another pass at thisafter this pr and catch the rest that I missed. It's fine to read from these fields in either the
snuba_query or alert_rule, since we're keeping the two in sync at the moment.