Skip to content

Commit

Permalink
update bucket calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidstanke committed Jul 28, 2022
1 parent 1fca39f commit 4fc9134
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ LIMIT 1;
```sql
SELECT
TIMESTAMP_TRUNC(d.time_created, DAY) as day,
SUM(IF(i.incident_id is NULL, 0, 1)) / COUNT(DISTINCT change_id) as change_fail_rate
SUM(IF(i.incident_id is NULL, 0, 1)) / COUNT(DISTINCT deploy_id) as change_fail_rate
FROM four_keys.deployments d, d.changes
LEFT JOIN four_keys.changes c ON changes = c.change_id
LEFT JOIN(SELECT
Expand Down
2 changes: 1 addition & 1 deletion dashboard/fourkeys_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@
"orderByCol": "1",
"orderBySort": "1",
"rawQuery": true,
"rawSql": "SELECT\nCASE WHEN change_fail_rate <= .15 then \"0-15%\"\n WHEN change_fail_rate < .46 then \"16-45%\"\n ELSE \"46-60%\" end as change_fail_rate\nFROM \n (SELECT\n IF(COUNT(DISTINCT change_id) = 0,0, SUM(IF(i.incident_id is NULL, 0, 1)) / COUNT(DISTINCT change_id)) as change_fail_rate\n FROM four_keys.deployments d, d.changes\n LEFT JOIN four_keys.changes c ON changes = c.change_id\n LEFT JOIN(SELECT\n incident_id,\n change,\n time_resolved\n FROM four_keys.incidents i,\n i.changes change) i ON i.change = changes\n # Limit to 3 months\n WHERE d.time_created > TIMESTAMP(DATE_SUB(CURRENT_DATE(), INTERVAL 3 MONTH))\n )\nLIMIT 1",
"rawSql": "SELECT\nCASE WHEN change_fail_rate <= .15 then \"0-15%\"\n WHEN change_fail_rate < .46 then \"16-45%\"\n ELSE \"46-60%\" end as change_fail_rate\nFROM \n (SELECT\n IF(COUNT(DISTINCT change_id) = 0,0, SUM(IF(i.incident_id is NULL, 0, 1)) / COUNT(DISTINCT deploy_id)) as change_fail_rate\n FROM four_keys.deployments d, d.changes\n LEFT JOIN four_keys.changes c ON changes = c.change_id\n LEFT JOIN(SELECT\n incident_id,\n change,\n time_resolved\n FROM four_keys.incidents i,\n i.changes change) i ON i.change = changes\n # Limit to 3 months\n WHERE d.time_created > TIMESTAMP(DATE_SUB(CURRENT_DATE(), INTERVAL 3 MONTH))\n )\nLIMIT 1",
"refId": "A",
"select": [
[
Expand Down

0 comments on commit 4fc9134

Please sign in to comment.