Skip to content

Commit c5cbabd

Browse files
authored
Merge pull request #4 from tinybirdco/add-view
feat: add datasources and materializations for trace timing aggregations
2 parents fd7c018 + f3dde76 commit c5cbabd

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
DESCRIPTION >
2+
Target datasource for trace timing aggregations with TraceId start and end times
3+
4+
SCHEMA >
5+
`TraceId` String,
6+
`Start` DateTime64(9) CODEC(Delta(8), ZSTD(1)),
7+
`End` DateTime64(9) CODEC(Delta(8), ZSTD(1)),
8+
9+
ENGINE "MergeTree"
10+
ENGINE_SORTING_KEY "TraceId, toUnixTimestamp(Start)"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
DESCRIPTION >
2+
Materialized view to aggregate trace start and end times by TraceId
3+
4+
NODE otel_traces_trace_id_ts_mv_node
5+
SQL >
6+
SELECT
7+
TraceId,
8+
min(Timestamp) AS Start,
9+
max(Timestamp) AS End
10+
FROM otel_traces
11+
WHERE TraceId != ''
12+
GROUP BY TraceId
13+
14+
TYPE MATERIALIZED
15+
DATASOURCE otel_traces_trace_id_ts

0 commit comments

Comments
 (0)