Skip to content

refs(subscriptions): Start using fields from snuba_query to replace fields on the alert rule#18751

Merged
wedamija merged 1 commit into
masterfrom
danf/use_snuba_query_fields
May 13, 2020
Merged

refs(subscriptions): Start using fields from snuba_query to replace fields on the alert rule#18751
wedamija merged 1 commit into
masterfrom
danf/use_snuba_query_fields

Conversation

@wedamija

Copy link
Copy Markdown
Member

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.

@wedamija wedamija requested review from a team and iProgramStuff May 12, 2020 02:21
@wedamija wedamija force-pushed the danf/use_snuba_query_fields branch from 56a82c1 to f3d9e90 Compare May 12, 2020 02:24
@wedamija wedamija changed the title refs(subscriptions): Start using fields from snuba_query to replacefields on the alert rule refs(subscriptions): Start using fields from snuba_query to replace fields on the alert rule May 12, 2020
@wedamija wedamija force-pushed the danf/use_snuba_query_fields branch from f3d9e90 to 0507687 Compare May 13, 2020 01:35
@wedamija wedamija force-pushed the danf/use_snuba_query_fields branch from 0507687 to 8f432be Compare May 13, 2020 01:38
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.

def serialize(self, obj, attrs, user):
env = obj.snuba_query.environment
aggregation = aggregate_to_query_aggregation.get(obj.snuba_query.aggregate).value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this lookup will fail because with the new performance selector we will be saving aggregates we don't recognize.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will now be a string instead of 0/1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@wedamija wedamija merged commit 9c7e359 into master May 13, 2020
@wedamija wedamija deleted the danf/use_snuba_query_fields branch May 13, 2020 21:35
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.
wedamija added a commit that referenced this pull request May 13, 2020
…elds on the alert rule. (#18780)

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.
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants