Skip to content

Commit 200b735

Browse files
authored
fix(otel): clickhouse logs/span metrics now exclude partials and debug events (#2581)
1 parent eeed38d commit 200b735

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

internal-packages/clickhouse/schema/008_add_task_events_v1_mvs.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ GROUP BY organization_id, project_id, environment_id, bucket_start;
4949

5050

5151
-- +goose Down
52-
DROP MATERIALIZED VIEW IF EXISTS trigger_dev.mv_task_event_usage_by_minute_v1;
53-
DROP MATERIALIZED VIEW IF EXISTS trigger_dev.mv_task_event_usage_by_hour_v1;
52+
DROP TABLE IF EXISTS trigger_dev.mv_task_event_usage_by_minute_v1;
53+
DROP TABLE IF EXISTS trigger_dev.mv_task_event_usage_by_hour_v1;
5454
DROP TABLE IF EXISTS trigger_dev.task_event_usage_by_hour_v1;
5555
DROP TABLE IF EXISTS trigger_dev.task_event_usage_by_minute_v1;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- +goose Up
2+
DROP TABLE IF EXISTS trigger_dev.mv_task_event_usage_by_minute_v1;
3+
4+
CREATE MATERIALIZED VIEW IF NOT EXISTS trigger_dev.mv_task_event_usage_by_minute_v2
5+
TO trigger_dev.task_event_usage_by_minute_v1 AS
6+
SELECT
7+
organization_id,
8+
project_id,
9+
environment_id,
10+
toStartOfMinute(start_time) AS bucket_start,
11+
count() AS event_count
12+
FROM trigger_dev.task_events_v1
13+
WHERE kind != 'DEBUG_EVENT' AND kind != 'ANCESTOR_OVERRIDE' AND status != 'PARTIAL'
14+
GROUP BY organization_id, project_id, environment_id, bucket_start;
15+
16+
17+
-- +goose Down
18+
DROP TABLE IF EXISTS trigger_dev.mv_task_event_usage_by_minute_v2;
19+
20+
CREATE MATERIALIZED VIEW IF NOT EXISTS trigger_dev.mv_task_event_usage_by_minute_v1
21+
TO trigger_dev.task_event_usage_by_minute_v1 AS
22+
SELECT
23+
organization_id,
24+
project_id,
25+
environment_id,
26+
toStartOfMinute(start_time) AS bucket_start,
27+
count() AS event_count
28+
FROM trigger_dev.task_events_v1
29+
GROUP BY organization_id, project_id, environment_id, bucket_start;

0 commit comments

Comments
 (0)