@mastra/clickhouse 1.27.0-alpha.2 → 1.27.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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +85 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +86 -15
- package/dist/index.js.map +1 -1
- package/dist/storage/db/utils.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/ddl.d.ts +8 -3
- package/dist/storage/domains/observability/v-next/ddl.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/helpers.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-clickhouse
|
|
|
3
3
|
description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/clickhouse"
|
|
6
|
-
version: "1.27.0
|
|
6
|
+
version: "1.27.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/dist/index.cjs
CHANGED
|
@@ -323,7 +323,8 @@ const JSON_FIELDS = [
|
|
|
323
323
|
"output",
|
|
324
324
|
"error",
|
|
325
325
|
"scope",
|
|
326
|
-
"links"
|
|
326
|
+
"links",
|
|
327
|
+
"stopReasonContext"
|
|
327
328
|
];
|
|
328
329
|
const NULLABLE_STRING_FIELDS = ["parentSpanId", "error"];
|
|
329
330
|
function transformRow(row) {
|
|
@@ -2738,6 +2739,17 @@ CREATE TABLE IF NOT EXISTS ${TABLE_SPAN_EVENTS} (
|
|
|
2738
2739
|
endedAt DateTime64(3, 'UTC'),
|
|
2739
2740
|
timeToFirstChunkMs Nullable(Float64),
|
|
2740
2741
|
|
|
2742
|
+
-- Native span fields, stored as supplied (NULL when the producer set none)
|
|
2743
|
+
externalParentSpanId Nullable(String),
|
|
2744
|
+
resumedFromSpanId Nullable(String),
|
|
2745
|
+
model LowCardinality(Nullable(String)),
|
|
2746
|
+
provider LowCardinality(Nullable(String)),
|
|
2747
|
+
outcome LowCardinality(Nullable(String)),
|
|
2748
|
+
stopReason LowCardinality(Nullable(String)),
|
|
2749
|
+
stopReasonContext Nullable(String),
|
|
2750
|
+
timeToFirstTokenMs Nullable(Float64),
|
|
2751
|
+
errorCount Nullable(UInt32),
|
|
2752
|
+
|
|
2741
2753
|
-- Query-relevant flexible fields
|
|
2742
2754
|
tags Array(LowCardinality(String)) DEFAULT [],
|
|
2743
2755
|
metadataSearch Map(LowCardinality(String), String) DEFAULT map(),
|
|
@@ -2812,6 +2824,17 @@ CREATE TABLE IF NOT EXISTS ${TABLE_TRACE_ROOTS} (
|
|
|
2812
2824
|
endedAt DateTime64(3, 'UTC'),
|
|
2813
2825
|
timeToFirstChunkMs Nullable(Float64),
|
|
2814
2826
|
|
|
2827
|
+
-- Native span fields, stored as supplied (NULL when the producer set none)
|
|
2828
|
+
externalParentSpanId Nullable(String),
|
|
2829
|
+
resumedFromSpanId Nullable(String),
|
|
2830
|
+
model LowCardinality(Nullable(String)),
|
|
2831
|
+
provider LowCardinality(Nullable(String)),
|
|
2832
|
+
outcome LowCardinality(Nullable(String)),
|
|
2833
|
+
stopReason LowCardinality(Nullable(String)),
|
|
2834
|
+
stopReasonContext Nullable(String),
|
|
2835
|
+
timeToFirstTokenMs Nullable(Float64),
|
|
2836
|
+
errorCount Nullable(UInt32),
|
|
2837
|
+
|
|
2815
2838
|
-- Query-relevant flexible fields
|
|
2816
2839
|
tags Array(LowCardinality(String)) DEFAULT [],
|
|
2817
2840
|
metadataSearch Map(LowCardinality(String), String) DEFAULT map(),
|
|
@@ -2898,6 +2921,17 @@ CREATE TABLE IF NOT EXISTS ${TABLE_TRACE_BRANCHES} (
|
|
|
2898
2921
|
endedAt DateTime64(3, 'UTC'),
|
|
2899
2922
|
timeToFirstChunkMs Nullable(Float64),
|
|
2900
2923
|
|
|
2924
|
+
-- Native span fields, stored as supplied (NULL when the producer set none)
|
|
2925
|
+
externalParentSpanId Nullable(String),
|
|
2926
|
+
resumedFromSpanId Nullable(String),
|
|
2927
|
+
model LowCardinality(Nullable(String)),
|
|
2928
|
+
provider LowCardinality(Nullable(String)),
|
|
2929
|
+
outcome LowCardinality(Nullable(String)),
|
|
2930
|
+
stopReason LowCardinality(Nullable(String)),
|
|
2931
|
+
stopReasonContext Nullable(String),
|
|
2932
|
+
timeToFirstTokenMs Nullable(Float64),
|
|
2933
|
+
errorCount Nullable(UInt32),
|
|
2934
|
+
|
|
2901
2935
|
-- Query-relevant flexible fields
|
|
2902
2936
|
tags Array(LowCardinality(String)) DEFAULT [],
|
|
2903
2937
|
metadataSearch Map(LowCardinality(String), String) DEFAULT map(),
|
|
@@ -3633,6 +3667,25 @@ function buildAllMvDDL(strategy) {
|
|
|
3633
3667
|
}
|
|
3634
3668
|
/** Discovery-specific refreshable MVs — created separately from core MVs. */
|
|
3635
3669
|
const DISCOVERY_MV_DDL = [DISCOVERY_VALUES_MV_DDL, DISCOVERY_PAIRS_MV_DDL];
|
|
3670
|
+
/**
|
|
3671
|
+
* Span columns added after the first span tables shipped, with their types.
|
|
3672
|
+
* Present on span events, trace roots and trace branches.
|
|
3673
|
+
*/
|
|
3674
|
+
const ADDED_SPAN_COLUMNS = [
|
|
3675
|
+
["inputPreview", "Nullable(String)"],
|
|
3676
|
+
["outputPreview", "Nullable(String)"],
|
|
3677
|
+
["errorPreview", "Nullable(String)"],
|
|
3678
|
+
["timeToFirstChunkMs", "Nullable(Float64)"],
|
|
3679
|
+
["externalParentSpanId", "Nullable(String)"],
|
|
3680
|
+
["resumedFromSpanId", "Nullable(String)"],
|
|
3681
|
+
["model", "LowCardinality(Nullable(String))"],
|
|
3682
|
+
["provider", "LowCardinality(Nullable(String))"],
|
|
3683
|
+
["outcome", "LowCardinality(Nullable(String))"],
|
|
3684
|
+
["stopReason", "LowCardinality(Nullable(String))"],
|
|
3685
|
+
["stopReasonContext", "Nullable(String)"],
|
|
3686
|
+
["timeToFirstTokenMs", "Nullable(Float64)"],
|
|
3687
|
+
["errorCount", "Nullable(UInt32)"]
|
|
3688
|
+
];
|
|
3636
3689
|
const addColumn = (table, name, type) => ({
|
|
3637
3690
|
kind: "column",
|
|
3638
3691
|
table,
|
|
@@ -3657,14 +3710,11 @@ const LOG_SKIP_INDEX_COLUMNS = [
|
|
|
3657
3710
|
"requestId"
|
|
3658
3711
|
];
|
|
3659
3712
|
const ALL_MIGRATIONS = [
|
|
3660
|
-
...[
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
]
|
|
3665
|
-
addColumn(TABLE_SPAN_EVENTS, "inputPreview", "Nullable(String)"),
|
|
3666
|
-
addColumn(TABLE_SPAN_EVENTS, "outputPreview", "Nullable(String)"),
|
|
3667
|
-
addColumn(TABLE_SPAN_EVENTS, "errorPreview", "Nullable(String)"),
|
|
3713
|
+
...ADDED_SPAN_COLUMNS.flatMap(([column, type]) => [
|
|
3714
|
+
addColumn(TABLE_TRACE_ROOTS, column, type),
|
|
3715
|
+
addColumn(TABLE_TRACE_BRANCHES, column, type),
|
|
3716
|
+
addColumn(TABLE_SPAN_EVENTS, column, type)
|
|
3717
|
+
]),
|
|
3668
3718
|
addColumn(TABLE_TRACE_BRANCHES, "entityVersionId", "Nullable(String)"),
|
|
3669
3719
|
addColumn(TABLE_TRACE_BRANCHES, "parentEntityVersionId", "Nullable(String)"),
|
|
3670
3720
|
addColumn(TABLE_TRACE_BRANCHES, "rootEntityVersionId", "Nullable(String)"),
|
|
@@ -3705,10 +3755,7 @@ const ALL_MIGRATIONS = [
|
|
|
3705
3755
|
addBloomIndex(TABLE_METRIC_EVENTS, "idx_sessionId", "sessionId"),
|
|
3706
3756
|
addBloomIndex(TABLE_METRIC_EVENTS, "idx_requestId", "requestId"),
|
|
3707
3757
|
...LOG_SKIP_INDEX_COLUMNS.map((column) => addBloomIndex(TABLE_LOG_EVENTS, `idx_${column}`, column)),
|
|
3708
|
-
addBloomIndex(TABLE_DELETION_REQUESTS, "idx_predicateValues", "predicateValues")
|
|
3709
|
-
addColumn(TABLE_TRACE_ROOTS, "timeToFirstChunkMs", "Nullable(Float64)"),
|
|
3710
|
-
addColumn(TABLE_TRACE_BRANCHES, "timeToFirstChunkMs", "Nullable(Float64)"),
|
|
3711
|
-
addColumn(TABLE_SPAN_EVENTS, "timeToFirstChunkMs", "Nullable(Float64)")
|
|
3758
|
+
addBloomIndex(TABLE_DELETION_REQUESTS, "idx_predicateValues", "predicateValues")
|
|
3712
3759
|
];
|
|
3713
3760
|
const ALL_TABLE_NAMES = [
|
|
3714
3761
|
TABLE_SPAN_EVENTS,
|
|
@@ -3959,6 +4006,11 @@ const PROMOTED_KEYS = /* @__PURE__ */ new Set([
|
|
|
3959
4006
|
"executionSource",
|
|
3960
4007
|
"serviceName"
|
|
3961
4008
|
]);
|
|
4009
|
+
function nullableNumber$1(value) {
|
|
4010
|
+
if (value == null || value === "") return null;
|
|
4011
|
+
const n = Number(value);
|
|
4012
|
+
return Number.isNaN(n) ? null : n;
|
|
4013
|
+
}
|
|
3962
4014
|
function nullableString(value) {
|
|
3963
4015
|
return typeof value === "string" ? value === "" ? null : value : value == null ? null : String(value);
|
|
3964
4016
|
}
|
|
@@ -4040,6 +4092,7 @@ function rowToSpanRecord(row) {
|
|
|
4040
4092
|
const startedAt = toDate(row.startedAt);
|
|
4041
4093
|
const endedAt = row.isEvent ? startedAt : toDateOrNull(row.endedAt);
|
|
4042
4094
|
const error = parseJson(row.error);
|
|
4095
|
+
const attributes = parseJson(row.attributes);
|
|
4043
4096
|
return {
|
|
4044
4097
|
traceId: row.traceId,
|
|
4045
4098
|
spanId: row.spanId,
|
|
@@ -4075,12 +4128,21 @@ function rowToSpanRecord(row) {
|
|
|
4075
4128
|
tags: normalizeTags(row.tags),
|
|
4076
4129
|
metadata: parseJson(row.metadataRaw) ?? void 0,
|
|
4077
4130
|
scope: parseJson(row.scope) ?? void 0,
|
|
4078
|
-
attributes:
|
|
4131
|
+
attributes: attributes ?? void 0,
|
|
4079
4132
|
links: parseJson(row.links) ?? void 0,
|
|
4080
4133
|
input: parseJson(row.input) ?? void 0,
|
|
4081
4134
|
output: parseJson(row.output) ?? void 0,
|
|
4082
4135
|
error: error ?? void 0,
|
|
4083
4136
|
requestContext: parseJson(row.requestContext) ?? void 0,
|
|
4137
|
+
externalParentSpanId: nullableString(row.externalParentSpanId),
|
|
4138
|
+
resumedFromSpanId: nullableString(row.resumedFromSpanId),
|
|
4139
|
+
model: nullableString(row.model) ?? (0, _mastra_core_storage.getStringAttribute)(attributes, "model"),
|
|
4140
|
+
provider: nullableString(row.provider) ?? (0, _mastra_core_storage.getStringAttribute)(attributes, "provider"),
|
|
4141
|
+
outcome: nullableString(row.outcome),
|
|
4142
|
+
stopReason: nullableString(row.stopReason),
|
|
4143
|
+
stopReasonContext: parseJson(row.stopReasonContext) ?? null,
|
|
4144
|
+
timeToFirstTokenMs: nullableNumber$1(row.timeToFirstTokenMs),
|
|
4145
|
+
errorCount: nullableNumber$1(row.errorCount),
|
|
4084
4146
|
createdAt: startedAt,
|
|
4085
4147
|
updatedAt: null
|
|
4086
4148
|
};
|
|
@@ -4154,6 +4216,15 @@ function spanRecordToRow(span) {
|
|
|
4154
4216
|
startedAt: toISOString(span.startedAt),
|
|
4155
4217
|
endedAt: toISOString(endedAt),
|
|
4156
4218
|
timeToFirstChunkMs: span.timeToFirstChunkMs ?? null,
|
|
4219
|
+
externalParentSpanId: span.externalParentSpanId ?? null,
|
|
4220
|
+
resumedFromSpanId: span.resumedFromSpanId ?? null,
|
|
4221
|
+
model: span.model ?? null,
|
|
4222
|
+
provider: span.provider ?? null,
|
|
4223
|
+
outcome: span.outcome ?? null,
|
|
4224
|
+
stopReason: span.stopReason ?? null,
|
|
4225
|
+
stopReasonContext: jsonEncode(span.stopReasonContext),
|
|
4226
|
+
timeToFirstTokenMs: span.timeToFirstTokenMs ?? null,
|
|
4227
|
+
errorCount: span.errorCount ?? null,
|
|
4157
4228
|
tags: normalizeTags(span.tags),
|
|
4158
4229
|
metadataSearch: buildMetadataSearch(metadata),
|
|
4159
4230
|
metadataRaw: jsonEncode(metadata),
|