@mastra/clickhouse 1.27.0-alpha.1 → 1.27.0-alpha.2
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 +1 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -24
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/observability/v-next/thread-query.d.ts +0 -2
- package/dist/storage/domains/observability/v-next/thread-query.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-alpha.
|
|
6
|
+
version: "1.27.0-alpha.2"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/dist/index.cjs
CHANGED
|
@@ -8588,7 +8588,7 @@ async function queryThreadRows(client, plan, timeoutMs, strategy = "auto") {
|
|
|
8588
8588
|
traceId, spanId, startedAt, endedAt) IN {roots:Array(Tuple(UInt8, String, UInt8, String, String, String, DateTime64(3, 'UTC'), DateTime64(3, 'UTC')))}`;
|
|
8589
8589
|
const stored = [];
|
|
8590
8590
|
for (const batch of batches([...roots.values()])) stored.push(...await run({
|
|
8591
|
-
query: `SELECT organizationId, traceId, spanId, startedAt, endedAt,
|
|
8591
|
+
query: `SELECT organizationId, traceId, spanId, startedAt, endedAt,
|
|
8592
8592
|
${contextFields.join(", ")}, if(spanType = 'agent_run', timeToFirstChunkMs, NULL) AS timeToFirstChunkMs,
|
|
8593
8593
|
if(isNull(error), 'success', 'error') AS status, ${PREVIEW_COLUMNS.join(", ")}
|
|
8594
8594
|
FROM ${TABLE_TRACE_ROOTS} WHERE ${rootWhere}
|
|
@@ -8608,31 +8608,10 @@ async function queryThreadRows(client, plan, timeoutMs, strategy = "auto") {
|
|
|
8608
8608
|
if (row) Object.assign(row, resolveStoredPreviews(row, payload));
|
|
8609
8609
|
}
|
|
8610
8610
|
}
|
|
8611
|
-
const firstRoots = page.map((row) => representative(row, "first")).filter((root) => byRoot.get(rootKey(root))?.spanType === "agent_run");
|
|
8612
|
-
const models = [];
|
|
8613
|
-
for (const batch of batches(firstRoots)) models.push(...await run({
|
|
8614
|
-
query: `SELECT organizationId, traceId,
|
|
8615
|
-
if(JSONType(attributes, 'model') = 'String', JSONExtractString(attributes, 'model'), NULL) AS model,
|
|
8616
|
-
if(JSONType(attributes, 'provider') = 'String', JSONExtractString(attributes, 'provider'), NULL) AS provider
|
|
8617
|
-
FROM ${TABLE_SPAN_EVENTS} WHERE spanType = 'model_generation' AND
|
|
8618
|
-
tuple(isNull(organizationId), ifNull(organizationId, ''), isNull(resourceId), ifNull(resourceId, ''), traceId, parentSpanId)
|
|
8619
|
-
IN {agents:Array(Tuple(UInt8, String, UInt8, String, String, String))}
|
|
8620
|
-
ORDER BY organizationId, traceId, startedAt, spanId LIMIT 1 BY organizationId, traceId`,
|
|
8621
|
-
query_params: { agents: batch.map((root) => new _clickhouse_client.TupleParam([
|
|
8622
|
-
root.organizationId === null ? 1 : 0,
|
|
8623
|
-
root.organizationId ?? "",
|
|
8624
|
-
root.resourceId === null ? 1 : 0,
|
|
8625
|
-
root.resourceId ?? "",
|
|
8626
|
-
root.traceId,
|
|
8627
|
-
root.spanId
|
|
8628
|
-
])) }
|
|
8629
|
-
}));
|
|
8630
|
-
const byTrace = new Map(models.map((row) => [JSON.stringify([row.organizationId, row.traceId]), row]));
|
|
8631
8611
|
const threads = page.flatMap((row) => {
|
|
8632
8612
|
const first = byRoot.get(rootKey(representative(row, "first")));
|
|
8633
8613
|
const last = byRoot.get(rootKey(representative(row, "last")));
|
|
8634
8614
|
if (!first || !last) return [];
|
|
8635
|
-
const model = byTrace.get(JSON.stringify([row.organizationId, row.firstTraceId]));
|
|
8636
8615
|
return [_mastra_core_storage.threadQueryRowSchema.parse({
|
|
8637
8616
|
organizationId: row.organizationId,
|
|
8638
8617
|
threadId: row.threadId,
|
|
@@ -8644,8 +8623,6 @@ async function queryThreadRows(client, plan, timeoutMs, strategy = "auto") {
|
|
|
8644
8623
|
endedAt: iso(row.endedAt),
|
|
8645
8624
|
traceCount: Number(row.traceCount),
|
|
8646
8625
|
timeToFirstChunkMs: first.timeToFirstChunkMs,
|
|
8647
|
-
model: model?.model ?? null,
|
|
8648
|
-
provider: model?.provider ?? null,
|
|
8649
8626
|
inputPreview: resolveStoredPreviews(first).inputPreview,
|
|
8650
8627
|
outputPreview: resolveStoredPreviews(last).outputPreview,
|
|
8651
8628
|
errorPreview: resolveStoredPreviews(last).errorPreview
|