Skip to content
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

delete hardcoded conversion between ns and ms #37

Merged
merged 1 commit into from
Dec 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ CREATE OR REPLACE VIEW watchops.incidents AS (
end as incident_id,
CASE WHEN source LIKE 'github%' THEN TO_TIMESTAMP(json_extract_path_text(json_serialize(metadata), 'issue', 'created_at'), 'YYYY-MM-DD HH24:MI:SS')
WHEN source LIKE 'gitlab%' THEN TO_TIMESTAMP(json_extract_path_text(json_serialize(metadata), 'object_attributes', 'created_at'), 'YYYY-MM-DD HH24:MI:SS')
WHEN source LIKE 'opsgenie' THEN dateadd(ms, CAST(json_extract_path_text(json_extract_path_text(json_serialize(metadata), 'alert'), 'createdAt') AS bigint), '1970-01-01')
WHEN source LIKE 'opsgenie' THEN dateadd(ms, CAST(json_extract_path_text(json_extract_path_text(json_serialize(metadata), 'alert'), 'createdAt') AS bigint), '1970-01-01')
end as time_created,
CASE WHEN source LIKE 'github%' THEN TO_TIMESTAMP(json_extract_path_text(json_serialize(metadata), 'issue', 'closed_at'), 'YYYY-MM-DD HH24:MI:SS')
WHEN source LIKE 'gitlab%' THEN TO_TIMESTAMP(json_extract_path_text(json_serialize(metadata), 'object_attributes', 'closed_at'), 'YYYY-MM-DD HH24:MI:SS')
WHEN source LIKE 'opsgenie' THEN dateadd(ms, CAST(json_extract_path_text(json_extract_path_text(json_serialize(metadata), 'alert'), 'updatedAt') AS bigint)/1000000, '1970-01-01') --updatedAt is in ns
WHEN source LIKE 'opsgenie' THEN dateadd(ms, CAST(json_extract_path_text(json_extract_path_text(json_serialize(metadata), 'alert'), 'updatedAt') AS bigint), '1970-01-01')
end as time_resolved,
CASE WHEN source LIKE 'github%' THEN json_extract_path_text(json_serialize(metadata), 'issue', 'labels') like '%bug%'
WHEN source LIKE 'gitlab%' THEN json_extract_path_text(json_serialize(metadata), 'object_attributes', 'labels','title') like '%ncident%'
Expand Down