@mastra/clickhouse 1.24.0 → 1.25.0-alpha.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/docs/references/integrations-databases-clickhouse.md +13 -0
- package/dist/docs/references/reference-storage-composite.md +34 -0
- package/dist/index.cjs +9 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -12
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +3 -1
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/trace-query.d.ts.map +1 -1
- package/package.json +3 -3
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.
|
|
6
|
+
version: "1.25.0-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -232,6 +232,19 @@ The same `client` form is accepted by `ObservabilityStorageClickhouse` and `Obse
|
|
|
232
232
|
|
|
233
233
|
`ClickhouseStore` also accepts every option from `ClickHouseClientConfigOptions` (such as `database`, `request_timeout`, `compression`, `keep_alive`, and `max_open_connections`).
|
|
234
234
|
|
|
235
|
+
`ClickhouseStore` and `ObservabilityStorageClickhouseVNext` apply `clickhouse_settings` to every query they run. On ClickHouse services that keep data in object storage, such as ClickHouse Cloud, limiting read-ahead lowers the memory each observability query uses, but queries that miss the local cache can run slower:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
const observabilityStore = new ObservabilityStorageClickhouseVNext({
|
|
239
|
+
url: process.env.CLICKHOUSE_URL!,
|
|
240
|
+
username: process.env.CLICKHOUSE_USERNAME!,
|
|
241
|
+
password: process.env.CLICKHOUSE_PASSWORD!,
|
|
242
|
+
clickhouse_settings: {
|
|
243
|
+
filesystem_prefetches_limit: 8,
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
```
|
|
247
|
+
|
|
235
248
|
### Replicated clusters
|
|
236
249
|
|
|
237
250
|
Use `replication` when Mastra writes to a multi-replica ClickHouse cluster through a load balancer.
|
|
@@ -210,6 +210,40 @@ export const mastra = new Mastra({
|
|
|
210
210
|
|
|
211
211
|
**domains.experiments** (`ExperimentsStorage`): Storage for experiment runs and per-item experiment results.
|
|
212
212
|
|
|
213
|
+
**domains.workflowDefinitions** (`WorkflowDefinitionsStorage`): Storage for persisted workflow definitions.
|
|
214
|
+
|
|
215
|
+
**domains.promptBlocks** (`PromptBlocksStorage`): Storage for stored prompt blocks and their versions.
|
|
216
|
+
|
|
217
|
+
**domains.scorerDefinitions** (`ScorerDefinitionsStorage`): Storage for stored scorer definitions and their versions.
|
|
218
|
+
|
|
219
|
+
**domains.mcpClients** (`MCPClientsStorage`): Storage for stored MCP client configurations and their versions.
|
|
220
|
+
|
|
221
|
+
**domains.mcpServers** (`MCPServersStorage`): Storage for stored MCP server configurations and their versions.
|
|
222
|
+
|
|
223
|
+
**domains.workspaces** (`WorkspacesStorage`): Storage for stored workspace configurations and their versions.
|
|
224
|
+
|
|
225
|
+
**domains.skills** (`SkillsStorage`): Storage for stored skill definitions and their versions.
|
|
226
|
+
|
|
227
|
+
**domains.favorites** (`FavoritesStorage`): Storage for user favorites on stored entities.
|
|
228
|
+
|
|
229
|
+
**domains.blobs** (`BlobStore`): Content-addressable storage for file contents used by skill versioning.
|
|
230
|
+
|
|
231
|
+
**domains.backgroundTasks** (`BackgroundTasksStorage`): Storage for background task state.
|
|
232
|
+
|
|
233
|
+
**domains.schedules** (`SchedulesStorage`): Storage for schedules that the scheduler fires.
|
|
234
|
+
|
|
235
|
+
**domains.channels** (`ChannelsStorage`): Storage for channel installations and configuration.
|
|
236
|
+
|
|
237
|
+
**domains.harness** (`HarnessStorage`): Storage for harness sessions.
|
|
238
|
+
|
|
239
|
+
**domains.toolProviderConnections** (`ToolProviderConnectionsStorage`): Storage for authorized tool provider connections.
|
|
240
|
+
|
|
241
|
+
**domains.notifications** (`NotificationsStorage`): Storage for notifications and their delivery state.
|
|
242
|
+
|
|
243
|
+
**domains.threadState** (`ThreadStateStorage`): Storage for per-thread agent state, such as task lists and goals.
|
|
244
|
+
|
|
245
|
+
**domains.knowledge** (`KnowledgeStorage`): Storage for knowledge nodes and records. Experimental.
|
|
246
|
+
|
|
213
247
|
## Initialization
|
|
214
248
|
|
|
215
249
|
`MastraCompositeStore` initializes each configured domain independently. When passed to the Mastra class, `init()` is called automatically:
|
package/dist/index.cjs
CHANGED
|
@@ -360,6 +360,7 @@ function resolveClickhouseConfig(config) {
|
|
|
360
360
|
username: config.username,
|
|
361
361
|
password: config.password,
|
|
362
362
|
clickhouse_settings: {
|
|
363
|
+
...config.clickhouse_settings,
|
|
363
364
|
date_time_input_format: "best_effort",
|
|
364
365
|
date_time_output_format: "iso",
|
|
365
366
|
use_client_time_zone: 1,
|
|
@@ -7106,18 +7107,14 @@ function compileClickHouseTraceScope(selection, relationCollections, parameters,
|
|
|
7106
7107
|
const to = parameters.add(selection.timeRange.to, "DateTime64(3, 'UTC')");
|
|
7107
7108
|
const tenant = compileTenantScope(scope, parameters);
|
|
7108
7109
|
const ctes = [`current_roots AS (
|
|
7109
|
-
SELECT *
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
)
|
|
7118
|
-
ORDER BY dedupeKey
|
|
7119
|
-
LIMIT 1 BY dedupeKey
|
|
7120
|
-
)
|
|
7110
|
+
SELECT *
|
|
7111
|
+
FROM ${TABLE_TRACE_ROOTS}
|
|
7112
|
+
WHERE traceId IN (
|
|
7113
|
+
SELECT traceId
|
|
7114
|
+
FROM ${TABLE_TRACE_ROOTS} r
|
|
7115
|
+
WHERE startedAt >= ${from}
|
|
7116
|
+
AND startedAt < ${to}${tenant}${seedConjuncts.map((conjunct) => `\n AND (${compilePredicate(conjunct, parameters)})`).join("")}
|
|
7117
|
+
)${tenant}
|
|
7121
7118
|
ORDER BY traceId, dedupeKey
|
|
7122
7119
|
LIMIT 1 BY traceId
|
|
7123
7120
|
)`, `root_scope AS (
|