Last active
March 14, 2019 22:45
-
-
Save vinoaj/8ce8e81f7169184901e2c9b4ac7b8d4d to your computer and use it in GitHub Desktop.
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
WITH error_stats AS ( | |
SELECT | |
labels.execution_id as execution_id | |
, MIN(resource.labels.function_name) as name | |
, MAX(IF(severity="ERROR", 1, 0)) as error | |
FROM `<dataset_id>.logging.cloudfunctions_googleapis_com_cloud_functions_*` | |
WHERE _TABLE_SUFFIX BETWEEN '20190101' AND '20190315' | |
GROUP BY labels.execution_id | |
) | |
SELECT | |
name | |
, ROUND((SUM(error)/COUNT(error)), 2) as proportion_with_errors | |
FROM error_stats | |
GROUP BY name | |
ORDER BY proportion_with_errors DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment