@@ -92,28 +92,32 @@ export const action: Action = async exec => {
92
92
, "trace_id" String CODEC(ZSTD(1))
93
93
, "span_id" String CODEC(ZSTD(1))
94
94
, "timestamp" DateTime('UTC') CODEC(DoubleDelta, LZ4)
95
- , "operation_name" String CODEC(ZSTD(1))
96
- , "operation_type" LowCardinality(String) CODEC(ZSTD(1))
97
- , "operation_body" String CODEC(ZSTD(1))
98
95
, "duration" UInt64 CODEC(T64, ZSTD(1))
99
- , "subgraph_names" Array(LowCardinality(String)) CODEC(ZSTD(1))
100
96
, "http_status_code" String CODEC(ZSTD(1))
101
97
, "http_method" String CODEC(ZSTD(1))
102
98
, "http_host" String CODEC(ZSTD(1))
103
99
, "http_route" String CODEC(ZSTD(1))
104
100
, "http_url" String CODEC(ZSTD(1))
105
- , INDEX "idx_operation_name" "operation_name" TYPE bloom_filter(0.01) GRANULARITY 1
106
- , INDEX "idx_operation_type" "operation_type" TYPE bloom_filter(0.01) GRANULARITY 1
101
+ , "client_name" String Codec(ZSTD(1))
102
+ , "client_version" String Codec(ZSTD(1))
103
+ , "graphql_operation_name" String CODEC(ZSTD(1))
104
+ , "graphql_operation_type" LowCardinality(String) CODEC(ZSTD(1))
105
+ , "graphql_operation_document" String CODEC(ZSTD(1))
106
+ , "subgraph_names" Array(LowCardinality(String)) CODEC(ZSTD(1))
107
107
, INDEX "idx_duration" "duration" TYPE minmax GRANULARITY 1
108
- , INDEX "idx_subgraph_names" "subgraph_names" TYPE bloom_filter(0.01) GRANULARITY 1
109
108
, INDEX "idx_http_status_code" "http_status_code" TYPE bloom_filter(0.01) GRANULARITY 1
110
109
, INDEX "idx_http_method" "http_method" TYPE bloom_filter(0.01) GRANULARITY 1
111
110
, INDEX "idx_http_host" "http_host" TYPE bloom_filter(0.01) GRANULARITY 1
112
111
, INDEX "idx_http_route" "http_route" TYPE bloom_filter(0.01) GRANULARITY 1
113
112
, INDEX "idx_http_url" "http_url" TYPE bloom_filter(0.01) GRANULARITY 1
113
+ , INDEX "idx_client_name" "client_name" TYPE bloom_filter(0.01) GRANULARITY 1
114
+ , INDEX "idx_client_version" "client_version" TYPE bloom_filter(0.01) GRANULARITY 1
115
+ , INDEX "idx_graphql_operation_name" "graphql_operation_name" TYPE bloom_filter(0.01) GRANULARITY 1
116
+ , INDEX "idx_graphql_operation_type" "graphql_operation_type" TYPE bloom_filter(0.01) GRANULARITY 1
117
+ , INDEX "idx_subgraph_names" "subgraph_names" TYPE bloom_filter(0.01) GRANULARITY 1
114
118
)
115
119
ENGINE = MergeTree
116
- PARTITION BY toDate(timestamp)
120
+ PARTITION BY toDate(" timestamp" )
117
121
ORDER BY ("target_id", "timestamp")
118
122
TTL toDateTime(timestamp) + toIntervalDay(365)
119
123
SETTINGS
@@ -123,37 +127,41 @@ export const action: Action = async exec => {
123
127
124
128
await exec ( `
125
129
CREATE MATERIALIZED VIEW IF NOT EXISTS "otel_traces_normalized_mv" TO "otel_traces_normalized" (
126
- "trace_id" String
130
+ , "target_id" LowCardinality(String)
131
+ , "trace_id" String
127
132
, "span_id" String
128
133
, "timestamp" DateTime('UTC')
129
- , "operation_name" String
130
- , "operation_type" LowCardinality(String)
131
- , "target_id" LowCardinality(String)
132
134
, "duration" UInt64
133
- , "operation_body" String
134
- , "subgraph_names" Array(String)
135
135
, "http_status_code" String
136
136
, "http_host" String
137
137
, "http_method" String
138
138
, "http_route" String
139
139
, "http_url" String
140
+ , "client_name" String
141
+ , "client_version" String
142
+ , "graphql_operation_name" String
143
+ , "graphql_operation_type" LowCardinality(String)
144
+ , "graphql_operation_document" String
145
+ , "subgraph_names" Array(String)
140
146
)
141
147
AS (
142
148
SELECT
143
- "TraceId" as "trace_id"
149
+ toLowCardinality("SpanAttributes"['hive.target_id']) AS "target_id"
150
+ , "TraceId" as "trace_id"
144
151
, "SpanId" AS "span_id"
145
152
, toDateTime("Timestamp", 'UTC') AS "timestamp"
146
- , "SpanAttributes"['graphql.operation.name'] AS operation_name
147
- , toLowCardinality("SpanAttributes"['graphql.operation.type']) AS "operation_type"
148
- , toLowCardinality("SpanAttributes"['hive.target_id']) AS "target_id"
149
153
, "Duration" AS "duration"
150
- , "SpanAttributes"['graphql.operation.document'] AS "operation_body"
151
- , arrayMap(x -> toLowCardinality(x), splitByChar(',', "SpanAttributes"['subgraph.names'])) AS "subgraph_names"
152
154
, "SpanAttributes"['http.status_code'] AS "http_status_code"
153
155
, "SpanAttributes"['http.host'] AS "http_host"
154
156
, "SpanAttributes"['http.method'] AS "http_method"
155
157
, "SpanAttributes"['http.route'] AS "http_route"
156
158
, "SpanAttributes"['http.url'] AS "http_url"
159
+ , "SpanAttributes"['hive.client.name'] AS "client_name"
160
+ , "SpanAttributes"['hive.client.version'] AS "client_version"
161
+ , "SpanAttributes"['graphql.operation.name'] AS "graphql_operation_name"
162
+ , toLowCardinality("SpanAttributes"['graphql.operation.type']) AS "graphql_operation_type"
163
+ , "SpanAttributes"['graphql.operation.document'] AS "graphql_operation_document"
164
+ , arrayMap(x -> toLowCardinality(x), splitByChar(',', "SpanAttributes"['hive.subgraph.names'])) AS "subgraph_names"
157
165
FROM
158
166
"otel_traces"
159
167
WHERE
0 commit comments