Skip to content

Commit

Permalink
Merge pull request #11 from mozilla-services/add-environment-field-to…
Browse files Browse the repository at this point in the history
…-views

Add environment field to views 🚀
  • Loading branch information
hackebrot authored Apr 4, 2024
2 parents 860c75c + 9635559 commit 185133a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion queries/deployments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ WITH
WHEN source LIKE "github%" THEN JSON_EXTRACT_SCALAR(metadata, '$.repository.full_name')
END
AS metadata_service,
CASE
WHEN source LIKE "github%" THEN JSON_EXTRACT_SCALAR(metadata, '$.deployment_status.environment')
END
AS metadata_environment,
id AS deploy_id,
time_created,
CASE
Expand Down Expand Up @@ -81,6 +85,7 @@ WITH
deploys.service,
deploys.metadata_service as deploys_service,
changes_raw.metadata_service as changes_service,
deploys.metadata_environment as environment,
deploy_id,
deploys.time_created time_created,
change_metadata,
Expand All @@ -98,6 +103,7 @@ SELECT
service,
deploys_service,
changes_service,
environment,
deploy_id,
time_created,
main_commit,
Expand All @@ -113,4 +119,5 @@ GROUP BY
4,
5,
6,
7;
7,
8;
7 changes: 5 additions & 2 deletions queries/incidents.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SELECT
metadata_service,
service_catalog.service,
incident_id,
root.environment as deployment_environment,
MIN(IF(root.time_created < issue.time_created, root.time_created, issue.time_created)) AS time_created,
MAX(time_resolved) AS time_resolved,
ARRAY_AGG(root_cause IGNORE NULLS) AS changes,
Expand Down Expand Up @@ -55,7 +56,8 @@ LEFT JOIN (
SELECT
time_created,
changes,
service
service,
environment
FROM
four_keys.deployments d,
d.changes
Expand All @@ -66,6 +68,7 @@ GROUP BY
1,
2,
3,
4
4,
5
HAVING
MAX(bug) IS TRUE ;

0 comments on commit 185133a

Please sign in to comment.