-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
ref(alerts): Update Snuba queries to match events-stats more closely #77755
base: master
Are you sure you want to change the base?
Conversation
@@ -42,6 +42,27 @@ | |||
from sentry.utils.snuba import MAX_FIELDS, SnubaTSResult | |||
|
|||
|
|||
def get_query_columns(columns, rollup): |
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.
I moved this to be reused by anomaly detection
""" | ||
serializer = SnubaTSResultSerializer(organization=organization, lookup=None, user=None) |
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.
I'm using the same serializer the events-stats
endpoint uses and just pulling that data off to format into a list of TimeSeriesPoint
s for Seer's API. I clicked through every alert type and it always has the timestamp and count
data, | ||
resolve_axis_column(query_columns[0]), | ||
allow_partial_buckets=False, | ||
zerofill_results=False, |
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.
I was getting strange results in tests with this set to True, and for our purposes I think it doesn't matter that much since we default to sending Seer a 0 if we don't find a count anyway
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.
By "strange" I mean it was hitting this line and overwriting data with a count I had in a test as an empty array.
❌ 3 Tests Failed:
View the top 3 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
634ed2c
to
4dfe836
Compare
stats_period=None, | ||
environments=environments, | ||
) | ||
snuba_query_string = get_snuba_query_string(snuba_query) |
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.
This is one of the key changes here - the front end constructs a stringified query based on snuba_query.query
AND snuba_query.event_types
. This adds a join to the table for things like errors count with the is:unresolved
query, or when you're using the dropdown to select "errors", "default", or "errors OR default" event types
The users experiencing errors query is selecting data as a different name but it's otherwise the same, I don't know if that makes a difference to the outcome?
anomaly detection: |
When a user creates an anomaly detection alert we need to query snuba for 28 days worth of historical data to send to Seer to calculate the anomalies. Originally (#74614) I'd tried to pull out the relevant parts of the
events-stats
endpoint to mimic the data we see populated in metric alert preview charts (but for a larger time period, and it's happening after the rule is saved so I can't use any of therequest
object stuff) but I think I missed some things, so this PR aims to make that data be the same.Closes https://getsentry.atlassian.net/browse/ALRT-288 (hopefully)
TODO
events-stats
SQL output against anomaly detection's