-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy path002_create_spans.sql
More file actions
31 lines (30 loc) · 1.14 KB
/
002_create_spans.sql
File metadata and controls
31 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- +goose Up
CREATE TABLE IF NOT EXISTS spans
(
span_id String,
trace_id String,
parent_span_id Nullable(String),
project_id String,
span_start_time DateTime64(3),
span_end_time Nullable(DateTime64(3)),
name String,
span_kind String,
status String DEFAULT 'OK',
status_message Nullable(String),
model_name Nullable(String),
cost Nullable(Decimal64(9)),
input_tokens Nullable(Int64),
output_tokens Nullable(Int64),
total_tokens Nullable(Int64),
input Nullable(String) CODEC(ZSTD(3)),
output Nullable(String) CODEC(ZSTD(3)),
environment String DEFAULT 'default',
metadata Nullable(String) CODEC(ZSTD(3)),
ch_create_time DateTime64(3) DEFAULT now64(3),
ch_update_time DateTime64(3) DEFAULT now64(3)
)
ENGINE = ReplacingMergeTree(ch_update_time)
PARTITION BY toYYYYMM(span_start_time)
ORDER BY (project_id, span_kind, toDate(span_start_time), span_id);
-- +goose Down
DROP TABLE IF EXISTS spans;