Skip to content

Commit a3afb8b

Browse files
committed
added trace_id != '' condition to materialized task_events_search_mv_v1
This will prevent internal logs to be added.
1 parent 921285c commit a3afb8b

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
-- +goose Up
2+
-- We drop the existing MV and recreate it with the new filter condition
3+
DROP VIEW IF EXISTS trigger_dev.task_events_search_mv_v1;
4+
5+
CREATE MATERIALIZED VIEW IF NOT EXISTS trigger_dev.task_events_search_mv_v1
6+
TO trigger_dev.task_events_search_v1 AS
7+
SELECT
8+
environment_id,
9+
organization_id,
10+
project_id,
11+
trace_id,
12+
span_id,
13+
run_id,
14+
task_identifier,
15+
start_time,
16+
inserted_at,
17+
message,
18+
kind,
19+
status,
20+
duration,
21+
parent_span_id,
22+
attributes_text,
23+
fromUnixTimestamp64Nano(toUnixTimestamp64Nano(start_time) + toInt64(duration)) AS triggered_timestamp
24+
FROM trigger_dev.task_events_v2
25+
WHERE
26+
trace_id != '' -- New condition added here
27+
AND kind != 'DEBUG_EVENT'
28+
AND status != 'PARTIAL'
29+
AND NOT (kind = 'SPAN_EVENT' AND attributes_text = '{}')
30+
AND kind != 'ANCESTOR_OVERRIDE'
31+
AND message != 'trigger.dev/start';
32+
33+
-- +goose Down
34+
-- In the down migration, we revert to the previous filter set
35+
DROP VIEW IF EXISTS trigger_dev.task_events_search_mv_v1;
36+
37+
CREATE MATERIALIZED VIEW IF NOT EXISTS trigger_dev.task_events_search_mv_v1
38+
TO trigger_dev.task_events_search_v1 AS
39+
SELECT
40+
environment_id,
41+
organization_id,
42+
project_id,
43+
trace_id,
44+
span_id,
45+
run_id,
46+
task_identifier,
47+
start_time,
48+
inserted_at,
49+
message,
50+
kind,
51+
status,
52+
duration,
53+
parent_span_id,
54+
attributes_text,
55+
fromUnixTimestamp64Nano(toUnixTimestamp64Nano(start_time) + toInt64(duration)) AS triggered_timestamp
56+
FROM trigger_dev.task_events_v2
57+
WHERE
58+
kind != 'DEBUG_EVENT'
59+
AND status != 'PARTIAL'
60+
AND NOT (kind = 'SPAN_EVENT' AND attributes_text = '{}')
61+
AND kind != 'ANCESTOR_OVERRIDE'
62+
AND message != 'trigger.dev/start';

0 commit comments

Comments
 (0)