@tungthedev/streams-server 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +45 -0
- package/CONTRIBUTING.md +76 -0
- package/LICENSE +201 -0
- package/README.md +58 -0
- package/SECURITY.md +42 -0
- package/bin/prisma-streams-server +2 -0
- package/package.json +46 -0
- package/src/app.ts +583 -0
- package/src/app_core.ts +3144 -0
- package/src/app_local.ts +206 -0
- package/src/auth.ts +124 -0
- package/src/auto_tune.ts +69 -0
- package/src/backpressure.ts +66 -0
- package/src/bootstrap.ts +613 -0
- package/src/compute/demo_entry.ts +415 -0
- package/src/compute/demo_site.ts +1242 -0
- package/src/compute/entry.ts +19 -0
- package/src/compute/package_entry.ts +4 -0
- package/src/compute/virtual-modules.d.ts +15 -0
- package/src/compute/worker_module_url.ts +9 -0
- package/src/concurrency_gate.ts +108 -0
- package/src/config.ts +402 -0
- package/src/db/bootstrap_store.ts +9 -0
- package/src/db/db.ts +2424 -0
- package/src/db/schema.ts +925 -0
- package/src/db/sqlite_manifest_snapshot.ts +81 -0
- package/src/db/sqlite_touch_store.ts +491 -0
- package/src/db/sqlite_wal_store.ts +472 -0
- package/src/details/full_mode_details.ts +568 -0
- package/src/expiry_sweeper.ts +47 -0
- package/src/foreground_activity.ts +55 -0
- package/src/hist.ts +169 -0
- package/src/index/binary_fuse.ts +379 -0
- package/src/index/indexer.ts +947 -0
- package/src/index/lexicon_file_cache.ts +261 -0
- package/src/index/lexicon_format.ts +93 -0
- package/src/index/lexicon_indexer.ts +863 -0
- package/src/index/run_cache.ts +84 -0
- package/src/index/run_format.ts +213 -0
- package/src/index/schedule.ts +28 -0
- package/src/index/secondary_indexer.ts +901 -0
- package/src/index/secondary_schema.ts +105 -0
- package/src/ingest.ts +309 -0
- package/src/lens/lens.ts +501 -0
- package/src/manifest.ts +249 -0
- package/src/memory.ts +334 -0
- package/src/metrics.ts +147 -0
- package/src/metrics_emitter.ts +83 -0
- package/src/notifier.ts +180 -0
- package/src/objectstore/accounting.ts +151 -0
- package/src/objectstore/interface.ts +13 -0
- package/src/objectstore/mock_r2.ts +269 -0
- package/src/objectstore/null.ts +32 -0
- package/src/objectstore/r2.ts +318 -0
- package/src/observe/pairing.ts +61 -0
- package/src/observe/request.ts +772 -0
- package/src/offset.ts +70 -0
- package/src/postgres/bootstrap.ts +269 -0
- package/src/postgres/companions.ts +197 -0
- package/src/postgres/control_restore.ts +109 -0
- package/src/postgres/details.ts +189 -0
- package/src/postgres/lexicon_index.ts +260 -0
- package/src/postgres/routing_index.ts +189 -0
- package/src/postgres/rows.ts +132 -0
- package/src/postgres/schema.ts +355 -0
- package/src/postgres/secondary_index.ts +238 -0
- package/src/postgres/segments.ts +900 -0
- package/src/postgres/stats.ts +103 -0
- package/src/postgres/store.ts +947 -0
- package/src/postgres/touch.ts +591 -0
- package/src/postgres/types.ts +32 -0
- package/src/profiles/evlog/schema.ts +234 -0
- package/src/profiles/evlog.ts +473 -0
- package/src/profiles/generic.ts +51 -0
- package/src/profiles/index.ts +237 -0
- package/src/profiles/metrics/block_format.ts +109 -0
- package/src/profiles/metrics/normalize.ts +366 -0
- package/src/profiles/metrics/schema.ts +319 -0
- package/src/profiles/metrics.ts +83 -0
- package/src/profiles/otelTraces/normalize.ts +955 -0
- package/src/profiles/otelTraces/otlp.ts +1002 -0
- package/src/profiles/otelTraces/schema.ts +408 -0
- package/src/profiles/otelTraces.ts +390 -0
- package/src/profiles/profile.ts +284 -0
- package/src/profiles/stateProtocol/change_event_conformance.typecheck.ts +35 -0
- package/src/profiles/stateProtocol/changes.ts +24 -0
- package/src/profiles/stateProtocol/ingest.ts +115 -0
- package/src/profiles/stateProtocol/routes.ts +511 -0
- package/src/profiles/stateProtocol/types.ts +6 -0
- package/src/profiles/stateProtocol/validation.ts +51 -0
- package/src/profiles/stateProtocol.ts +107 -0
- package/src/read_filter.ts +468 -0
- package/src/reader.ts +2986 -0
- package/src/runtime/hash.ts +156 -0
- package/src/runtime/hash_vendor/LICENSE.hash-wasm +38 -0
- package/src/runtime/hash_vendor/NOTICE.md +8 -0
- package/src/runtime/hash_vendor/xxhash3.umd.min.cjs +7 -0
- package/src/runtime/hash_vendor/xxhash32.umd.min.cjs +7 -0
- package/src/runtime/hash_vendor/xxhash64.umd.min.cjs +7 -0
- package/src/runtime/host_runtime.ts +5 -0
- package/src/runtime_memory.ts +200 -0
- package/src/runtime_memory_sampler.ts +237 -0
- package/src/schema/lens_schema.ts +290 -0
- package/src/schema/proof.ts +547 -0
- package/src/schema/read_json.ts +51 -0
- package/src/schema/registry.ts +966 -0
- package/src/search/agg_format.ts +638 -0
- package/src/search/aggregate.ts +409 -0
- package/src/search/binary/codec.ts +162 -0
- package/src/search/binary/docset.ts +67 -0
- package/src/search/binary/restart_strings.ts +181 -0
- package/src/search/binary/varint.ts +34 -0
- package/src/search/bitset.ts +19 -0
- package/src/search/col_format.ts +382 -0
- package/src/search/col_runtime.ts +59 -0
- package/src/search/column_encoding.ts +43 -0
- package/src/search/companion_file_cache.ts +319 -0
- package/src/search/companion_format.ts +327 -0
- package/src/search/companion_manager.ts +1305 -0
- package/src/search/companion_plan.ts +229 -0
- package/src/search/exact_format.ts +281 -0
- package/src/search/exact_runtime.ts +55 -0
- package/src/search/fts_format.ts +423 -0
- package/src/search/fts_runtime.ts +333 -0
- package/src/search/query.ts +875 -0
- package/src/search/schema.ts +245 -0
- package/src/segment/cache.ts +270 -0
- package/src/segment/cached_segment.ts +89 -0
- package/src/segment/format.ts +403 -0
- package/src/segment/segmenter.ts +412 -0
- package/src/segment/segmenter_worker.ts +72 -0
- package/src/segment/segmenter_workers.ts +130 -0
- package/src/server.ts +264 -0
- package/src/server_auto_tune.ts +158 -0
- package/src/sqlite/adapter.ts +335 -0
- package/src/sqlite/runtime_stats.ts +163 -0
- package/src/stats.ts +205 -0
- package/src/store/append.ts +50 -0
- package/src/store/bootstrap_restore_store.ts +71 -0
- package/src/store/capabilities.ts +86 -0
- package/src/store/full_mode_details_store.ts +71 -0
- package/src/store/index_store.ts +104 -0
- package/src/store/profile_touch_store.ts +1 -0
- package/src/store/rows.ts +144 -0
- package/src/store/schema_profile_store.ts +73 -0
- package/src/store/schema_publication.ts +6 -0
- package/src/store/segment_manifest_store.ts +129 -0
- package/src/store/segment_read_store.ts +22 -0
- package/src/store/stats_accounting_store.ts +83 -0
- package/src/store/touch_store.ts +98 -0
- package/src/store/wal_store.ts +21 -0
- package/src/stream_size_reconciler.ts +100 -0
- package/src/touch/canonical_change.ts +7 -0
- package/src/touch/live_keys.ts +158 -0
- package/src/touch/live_metrics.ts +841 -0
- package/src/touch/live_templates.ts +449 -0
- package/src/touch/manager.ts +1292 -0
- package/src/touch/process_batch.ts +576 -0
- package/src/touch/processor_worker.ts +85 -0
- package/src/touch/spec.ts +459 -0
- package/src/touch/touch_journal.ts +771 -0
- package/src/touch/touch_key_id.ts +20 -0
- package/src/touch/worker_pool.ts +191 -0
- package/src/touch/worker_protocol.ts +57 -0
- package/src/types/proper-lockfile.d.ts +1 -0
- package/src/uploader.ts +358 -0
- package/src/util/base32_crockford.ts +81 -0
- package/src/util/bloom256.ts +67 -0
- package/src/util/byte_lru.ts +73 -0
- package/src/util/cleanup.ts +22 -0
- package/src/util/crc32c.ts +29 -0
- package/src/util/ds_error.ts +15 -0
- package/src/util/duration.ts +17 -0
- package/src/util/endian.ts +53 -0
- package/src/util/json_pointer.ts +148 -0
- package/src/util/log.ts +25 -0
- package/src/util/lru.ts +53 -0
- package/src/util/retry.ts +35 -0
- package/src/util/siphash.ts +71 -0
- package/src/util/stream_paths.ts +50 -0
- package/src/util/time.ts +14 -0
- package/src/util/yield.ts +3 -0
- package/src/util/zstd.ts +24 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCHEMA_REGISTRY_API_VERSION,
|
|
3
|
+
type SchemaRegistry,
|
|
4
|
+
type SearchConfig,
|
|
5
|
+
type SearchFieldConfig,
|
|
6
|
+
} from "../../schema/registry";
|
|
7
|
+
|
|
8
|
+
const NULLABLE_STRING = { type: ["string", "null"] } as const;
|
|
9
|
+
const NULLABLE_NUMBER = { type: ["number", "null"] } as const;
|
|
10
|
+
const ATTRIBUTES_SCHEMA = { type: "object", additionalProperties: true } as const;
|
|
11
|
+
|
|
12
|
+
export const OTEL_TRACES_CANONICAL_SCHEMA = {
|
|
13
|
+
type: "object",
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
properties: {
|
|
16
|
+
schemaVersion: { type: "integer", enum: [1] },
|
|
17
|
+
signal: { type: "string", enum: ["trace.span"] },
|
|
18
|
+
timestamp: { type: "string" },
|
|
19
|
+
endTimestamp: NULLABLE_STRING,
|
|
20
|
+
startUnixNano: NULLABLE_STRING,
|
|
21
|
+
endUnixNano: NULLABLE_STRING,
|
|
22
|
+
duration: NULLABLE_NUMBER,
|
|
23
|
+
traceId: { type: "string" },
|
|
24
|
+
spanId: { type: "string" },
|
|
25
|
+
parentSpanId: NULLABLE_STRING,
|
|
26
|
+
traceState: NULLABLE_STRING,
|
|
27
|
+
traceFlags: {
|
|
28
|
+
type: "object",
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
properties: {
|
|
31
|
+
sampled: { type: "boolean" },
|
|
32
|
+
raw: { type: ["integer", "null"] },
|
|
33
|
+
},
|
|
34
|
+
required: ["sampled", "raw"],
|
|
35
|
+
},
|
|
36
|
+
name: { type: "string" },
|
|
37
|
+
kind: { type: "string", enum: ["unspecified", "internal", "server", "client", "producer", "consumer"] },
|
|
38
|
+
status: {
|
|
39
|
+
type: "object",
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
properties: {
|
|
42
|
+
code: { type: "string", enum: ["unset", "ok", "error"] },
|
|
43
|
+
message: NULLABLE_STRING,
|
|
44
|
+
},
|
|
45
|
+
required: ["code", "message"],
|
|
46
|
+
},
|
|
47
|
+
service: NULLABLE_STRING,
|
|
48
|
+
serviceNamespace: NULLABLE_STRING,
|
|
49
|
+
serviceInstanceId: NULLABLE_STRING,
|
|
50
|
+
environment: NULLABLE_STRING,
|
|
51
|
+
version: NULLABLE_STRING,
|
|
52
|
+
region: NULLABLE_STRING,
|
|
53
|
+
requestId: NULLABLE_STRING,
|
|
54
|
+
http: {
|
|
55
|
+
type: "object",
|
|
56
|
+
additionalProperties: false,
|
|
57
|
+
properties: {
|
|
58
|
+
method: NULLABLE_STRING,
|
|
59
|
+
route: NULLABLE_STRING,
|
|
60
|
+
path: NULLABLE_STRING,
|
|
61
|
+
target: NULLABLE_STRING,
|
|
62
|
+
url: NULLABLE_STRING,
|
|
63
|
+
statusCode: { type: ["integer", "null"] },
|
|
64
|
+
userAgent: NULLABLE_STRING,
|
|
65
|
+
},
|
|
66
|
+
required: ["method", "route", "path", "target", "url", "statusCode", "userAgent"],
|
|
67
|
+
},
|
|
68
|
+
db: {
|
|
69
|
+
type: "object",
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
properties: {
|
|
72
|
+
system: NULLABLE_STRING,
|
|
73
|
+
name: NULLABLE_STRING,
|
|
74
|
+
operation: NULLABLE_STRING,
|
|
75
|
+
statement: NULLABLE_STRING,
|
|
76
|
+
},
|
|
77
|
+
required: ["system", "name", "operation", "statement"],
|
|
78
|
+
},
|
|
79
|
+
rpc: {
|
|
80
|
+
type: "object",
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
properties: {
|
|
83
|
+
system: NULLABLE_STRING,
|
|
84
|
+
service: NULLABLE_STRING,
|
|
85
|
+
method: NULLABLE_STRING,
|
|
86
|
+
},
|
|
87
|
+
required: ["system", "service", "method"],
|
|
88
|
+
},
|
|
89
|
+
messaging: {
|
|
90
|
+
type: "object",
|
|
91
|
+
additionalProperties: false,
|
|
92
|
+
properties: {
|
|
93
|
+
system: NULLABLE_STRING,
|
|
94
|
+
destination: NULLABLE_STRING,
|
|
95
|
+
operation: NULLABLE_STRING,
|
|
96
|
+
},
|
|
97
|
+
required: ["system", "destination", "operation"],
|
|
98
|
+
},
|
|
99
|
+
error: {
|
|
100
|
+
type: "object",
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
properties: {
|
|
103
|
+
isError: { type: "boolean" },
|
|
104
|
+
type: NULLABLE_STRING,
|
|
105
|
+
message: NULLABLE_STRING,
|
|
106
|
+
stacktrace: NULLABLE_STRING,
|
|
107
|
+
},
|
|
108
|
+
required: ["isError", "type", "message", "stacktrace"],
|
|
109
|
+
},
|
|
110
|
+
instrumentationScope: {
|
|
111
|
+
type: "object",
|
|
112
|
+
additionalProperties: false,
|
|
113
|
+
properties: {
|
|
114
|
+
name: NULLABLE_STRING,
|
|
115
|
+
version: NULLABLE_STRING,
|
|
116
|
+
schemaUrl: NULLABLE_STRING,
|
|
117
|
+
attributes: ATTRIBUTES_SCHEMA,
|
|
118
|
+
},
|
|
119
|
+
required: ["name", "version", "schemaUrl", "attributes"],
|
|
120
|
+
},
|
|
121
|
+
resource: {
|
|
122
|
+
type: "object",
|
|
123
|
+
additionalProperties: false,
|
|
124
|
+
properties: {
|
|
125
|
+
schemaUrl: NULLABLE_STRING,
|
|
126
|
+
attributes: ATTRIBUTES_SCHEMA,
|
|
127
|
+
},
|
|
128
|
+
required: ["schemaUrl", "attributes"],
|
|
129
|
+
},
|
|
130
|
+
attributes: ATTRIBUTES_SCHEMA,
|
|
131
|
+
events: {
|
|
132
|
+
type: "array",
|
|
133
|
+
items: {
|
|
134
|
+
type: "object",
|
|
135
|
+
additionalProperties: false,
|
|
136
|
+
properties: {
|
|
137
|
+
timestamp: NULLABLE_STRING,
|
|
138
|
+
timeUnixNano: NULLABLE_STRING,
|
|
139
|
+
name: { type: "string" },
|
|
140
|
+
attributes: ATTRIBUTES_SCHEMA,
|
|
141
|
+
droppedAttributesCount: { type: "integer" },
|
|
142
|
+
},
|
|
143
|
+
required: ["timestamp", "timeUnixNano", "name", "attributes"],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
eventNames: {
|
|
147
|
+
type: "array",
|
|
148
|
+
items: { type: "string" },
|
|
149
|
+
},
|
|
150
|
+
links: {
|
|
151
|
+
type: "array",
|
|
152
|
+
items: {
|
|
153
|
+
type: "object",
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
properties: {
|
|
156
|
+
traceId: { type: "string" },
|
|
157
|
+
spanId: { type: "string" },
|
|
158
|
+
traceState: NULLABLE_STRING,
|
|
159
|
+
attributes: ATTRIBUTES_SCHEMA,
|
|
160
|
+
droppedAttributesCount: { type: "integer" },
|
|
161
|
+
},
|
|
162
|
+
required: ["traceId", "spanId", "traceState", "attributes"],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
dropped: {
|
|
166
|
+
type: "object",
|
|
167
|
+
additionalProperties: false,
|
|
168
|
+
properties: {
|
|
169
|
+
attributes: { type: "integer" },
|
|
170
|
+
events: { type: "integer" },
|
|
171
|
+
links: { type: "integer" },
|
|
172
|
+
},
|
|
173
|
+
required: ["attributes", "events", "links"],
|
|
174
|
+
},
|
|
175
|
+
redaction: {
|
|
176
|
+
type: "object",
|
|
177
|
+
additionalProperties: false,
|
|
178
|
+
properties: {
|
|
179
|
+
keys: {
|
|
180
|
+
type: "array",
|
|
181
|
+
items: { type: "string" },
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
required: ["keys"],
|
|
185
|
+
},
|
|
186
|
+
identity: {
|
|
187
|
+
type: "object",
|
|
188
|
+
additionalProperties: false,
|
|
189
|
+
properties: {
|
|
190
|
+
spanKey: { type: "string" },
|
|
191
|
+
dedupeKey: { type: "string" },
|
|
192
|
+
},
|
|
193
|
+
required: ["spanKey", "dedupeKey"],
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
required: [
|
|
197
|
+
"schemaVersion",
|
|
198
|
+
"signal",
|
|
199
|
+
"timestamp",
|
|
200
|
+
"endTimestamp",
|
|
201
|
+
"startUnixNano",
|
|
202
|
+
"endUnixNano",
|
|
203
|
+
"duration",
|
|
204
|
+
"traceId",
|
|
205
|
+
"spanId",
|
|
206
|
+
"parentSpanId",
|
|
207
|
+
"traceState",
|
|
208
|
+
"traceFlags",
|
|
209
|
+
"name",
|
|
210
|
+
"kind",
|
|
211
|
+
"status",
|
|
212
|
+
"service",
|
|
213
|
+
"serviceNamespace",
|
|
214
|
+
"serviceInstanceId",
|
|
215
|
+
"environment",
|
|
216
|
+
"version",
|
|
217
|
+
"region",
|
|
218
|
+
"requestId",
|
|
219
|
+
"http",
|
|
220
|
+
"db",
|
|
221
|
+
"rpc",
|
|
222
|
+
"messaging",
|
|
223
|
+
"error",
|
|
224
|
+
"instrumentationScope",
|
|
225
|
+
"resource",
|
|
226
|
+
"attributes",
|
|
227
|
+
"events",
|
|
228
|
+
"eventNames",
|
|
229
|
+
"links",
|
|
230
|
+
"dropped",
|
|
231
|
+
"redaction",
|
|
232
|
+
"identity",
|
|
233
|
+
],
|
|
234
|
+
} as const;
|
|
235
|
+
|
|
236
|
+
const exactKeyword = (jsonPointer: string, aggregatable = false): SearchFieldConfig => {
|
|
237
|
+
const field: SearchFieldConfig = {
|
|
238
|
+
kind: "keyword",
|
|
239
|
+
bindings: [{ version: 1, jsonPointer }],
|
|
240
|
+
exact: true,
|
|
241
|
+
prefix: true,
|
|
242
|
+
exists: true,
|
|
243
|
+
sortable: true,
|
|
244
|
+
};
|
|
245
|
+
if (aggregatable) field.aggregatable = true;
|
|
246
|
+
return field;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const lowercaseKeyword = (jsonPointer: string, aggregatable = false): SearchFieldConfig => ({
|
|
250
|
+
...exactKeyword(jsonPointer, aggregatable),
|
|
251
|
+
normalizer: "lowercase_v1",
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const textField = (jsonPointer: string): SearchFieldConfig => ({
|
|
255
|
+
kind: "text",
|
|
256
|
+
bindings: [{ version: 1, jsonPointer }],
|
|
257
|
+
analyzer: "unicode_word_v1",
|
|
258
|
+
exists: true,
|
|
259
|
+
positions: true,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export const OTEL_TRACES_DEFAULT_SEARCH_CONFIG: SearchConfig = {
|
|
263
|
+
profile: "otel-traces",
|
|
264
|
+
primaryTimestampField: "timestamp",
|
|
265
|
+
aliases: {
|
|
266
|
+
db: "db.system",
|
|
267
|
+
duration_ms: "duration",
|
|
268
|
+
error: "error.isError",
|
|
269
|
+
method: "http.method",
|
|
270
|
+
op: "name",
|
|
271
|
+
parent: "parentSpanId",
|
|
272
|
+
req: "requestId",
|
|
273
|
+
route: "http.route",
|
|
274
|
+
span: "spanId",
|
|
275
|
+
status: "http.statusCode",
|
|
276
|
+
svc: "service",
|
|
277
|
+
time: "timestamp",
|
|
278
|
+
trace: "traceId",
|
|
279
|
+
ts: "timestamp",
|
|
280
|
+
},
|
|
281
|
+
defaultFields: [
|
|
282
|
+
{ field: "name", boost: 2 },
|
|
283
|
+
{ field: "error.message", boost: 2 },
|
|
284
|
+
{ field: "status.message", boost: 1.5 },
|
|
285
|
+
{ field: "events.name", boost: 1.2 },
|
|
286
|
+
{ field: "db.statement", boost: 0.5 },
|
|
287
|
+
],
|
|
288
|
+
fields: {
|
|
289
|
+
timestamp: {
|
|
290
|
+
kind: "date",
|
|
291
|
+
bindings: [{ version: 1, jsonPointer: "/timestamp" }],
|
|
292
|
+
exact: true,
|
|
293
|
+
column: true,
|
|
294
|
+
exists: true,
|
|
295
|
+
sortable: true,
|
|
296
|
+
aggregatable: true,
|
|
297
|
+
},
|
|
298
|
+
endTimestamp: {
|
|
299
|
+
kind: "date",
|
|
300
|
+
bindings: [{ version: 1, jsonPointer: "/endTimestamp" }],
|
|
301
|
+
exact: true,
|
|
302
|
+
column: true,
|
|
303
|
+
exists: true,
|
|
304
|
+
sortable: true,
|
|
305
|
+
aggregatable: true,
|
|
306
|
+
},
|
|
307
|
+
duration: {
|
|
308
|
+
kind: "float",
|
|
309
|
+
bindings: [{ version: 1, jsonPointer: "/duration" }],
|
|
310
|
+
exact: true,
|
|
311
|
+
column: true,
|
|
312
|
+
exists: true,
|
|
313
|
+
sortable: true,
|
|
314
|
+
aggregatable: true,
|
|
315
|
+
},
|
|
316
|
+
traceId: exactKeyword("/traceId"),
|
|
317
|
+
spanId: exactKeyword("/spanId"),
|
|
318
|
+
parentSpanId: exactKeyword("/parentSpanId"),
|
|
319
|
+
requestId: exactKeyword("/requestId"),
|
|
320
|
+
service: lowercaseKeyword("/service", true),
|
|
321
|
+
serviceNamespace: lowercaseKeyword("/serviceNamespace", true),
|
|
322
|
+
serviceInstanceId: exactKeyword("/serviceInstanceId"),
|
|
323
|
+
environment: lowercaseKeyword("/environment", true),
|
|
324
|
+
version: exactKeyword("/version"),
|
|
325
|
+
region: lowercaseKeyword("/region", true),
|
|
326
|
+
name: {
|
|
327
|
+
kind: "keyword",
|
|
328
|
+
bindings: [{ version: 1, jsonPointer: "/name" }],
|
|
329
|
+
exact: true,
|
|
330
|
+
prefix: true,
|
|
331
|
+
exists: true,
|
|
332
|
+
sortable: true,
|
|
333
|
+
aggregatable: true,
|
|
334
|
+
},
|
|
335
|
+
kind: lowercaseKeyword("/kind", true),
|
|
336
|
+
"status.code": lowercaseKeyword("/status/code", true),
|
|
337
|
+
"status.message": textField("/status/message"),
|
|
338
|
+
"error.isError": {
|
|
339
|
+
kind: "bool",
|
|
340
|
+
bindings: [{ version: 1, jsonPointer: "/error/isError" }],
|
|
341
|
+
exact: true,
|
|
342
|
+
column: true,
|
|
343
|
+
exists: true,
|
|
344
|
+
sortable: true,
|
|
345
|
+
aggregatable: true,
|
|
346
|
+
},
|
|
347
|
+
"error.type": exactKeyword("/error/type", true),
|
|
348
|
+
"error.message": textField("/error/message"),
|
|
349
|
+
"error.stacktrace": textField("/error/stacktrace"),
|
|
350
|
+
"http.method": lowercaseKeyword("/http/method", true),
|
|
351
|
+
"http.route": exactKeyword("/http/route", true),
|
|
352
|
+
"http.path": exactKeyword("/http/path"),
|
|
353
|
+
"http.statusCode": {
|
|
354
|
+
kind: "integer",
|
|
355
|
+
bindings: [{ version: 1, jsonPointer: "/http/statusCode" }],
|
|
356
|
+
exact: true,
|
|
357
|
+
column: true,
|
|
358
|
+
exists: true,
|
|
359
|
+
sortable: true,
|
|
360
|
+
aggregatable: true,
|
|
361
|
+
},
|
|
362
|
+
"db.system": lowercaseKeyword("/db/system", true),
|
|
363
|
+
"db.operation": lowercaseKeyword("/db/operation", true),
|
|
364
|
+
"db.statement": textField("/db/statement"),
|
|
365
|
+
"rpc.system": lowercaseKeyword("/rpc/system", true),
|
|
366
|
+
"rpc.service": exactKeyword("/rpc/service", true),
|
|
367
|
+
"rpc.method": exactKeyword("/rpc/method", true),
|
|
368
|
+
"messaging.system": lowercaseKeyword("/messaging/system", true),
|
|
369
|
+
"messaging.destination": exactKeyword("/messaging/destination", true),
|
|
370
|
+
"messaging.operation": lowercaseKeyword("/messaging/operation", true),
|
|
371
|
+
"events.name": textField("/eventNames"),
|
|
372
|
+
},
|
|
373
|
+
rollups: {
|
|
374
|
+
spans: {
|
|
375
|
+
dimensions: ["service", "kind", "status.code"],
|
|
376
|
+
intervals: ["1m", "5m", "1h"],
|
|
377
|
+
measures: {
|
|
378
|
+
spans: { kind: "count" },
|
|
379
|
+
errors: { kind: "count", include: "error:true" },
|
|
380
|
+
latency: { kind: "summary", field: "duration", histogram: "log2_v1" },
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
http_server: {
|
|
384
|
+
include: "kind:server",
|
|
385
|
+
dimensions: ["service", "http.method", "http.route", "http.statusCode"],
|
|
386
|
+
intervals: ["1m", "5m", "1h"],
|
|
387
|
+
measures: {
|
|
388
|
+
requests: { kind: "count" },
|
|
389
|
+
errors: { kind: "count", include: "error:true" },
|
|
390
|
+
latency: { kind: "summary", field: "duration", histogram: "log2_v1" },
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export function buildOtelTracesDefaultRegistry(stream: string): SchemaRegistry {
|
|
397
|
+
return {
|
|
398
|
+
apiVersion: SCHEMA_REGISTRY_API_VERSION,
|
|
399
|
+
schema: stream,
|
|
400
|
+
currentVersion: 1,
|
|
401
|
+
search: structuredClone(OTEL_TRACES_DEFAULT_SEARCH_CONFIG),
|
|
402
|
+
boundaries: [{ offset: 0, version: 1 }],
|
|
403
|
+
schemas: {
|
|
404
|
+
"1": structuredClone(OTEL_TRACES_CANONICAL_SCHEMA),
|
|
405
|
+
},
|
|
406
|
+
lenses: {},
|
|
407
|
+
};
|
|
408
|
+
}
|