Created
June 8, 2021 05:58
-
-
Save pastuhov/f8eab084498a2707065d3b8216075f55 to your computer and use it in GitHub Desktop.
Sentry db query - issues
This file contains 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
SET TIME ZONE 5; | |
SELECT | |
error_count, | |
date_added, | |
error_count - lag(error_count, 1) | |
OVER () delta, | |
avg(error_count) | |
OVER () average_count, | |
CASE WHEN error_count > avg(error_count) OVER () | |
THEN 'BAD' | |
ELSE '' END | |
FROM ( | |
SELECT | |
count(id) error_count, | |
date_trunc('hour', date_added) AS date_added | |
FROM sentry_eventmapping | |
WHERE project_id = 28 AND date_added >= NOW() + INTERVAL '-24 hour' | |
GROUP BY date_trunc('hour', date_added) | |
ORDER BY date_trunc('hour', date_added) | |
) AS event |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment