@mastra/duckdb 0.0.0-studio-deploy-20260404184540 → 0.0.0-studio-cli-20260504022012
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/CHANGELOG.md +62 -3
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-storage-duckdb.md +150 -0
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/{observability-IME6BI7N.cjs → observability-AILZGFQT.cjs} +337 -16
- package/dist/observability-AILZGFQT.cjs.map +1 -0
- package/dist/{observability-J4YTASAF.js → observability-YJBOVLPV.js} +338 -17
- package/dist/observability-YJBOVLPV.js.map +1 -0
- package/dist/storage/domains/observability/ddl.d.ts +5 -5
- package/dist/storage/domains/observability/ddl.d.ts.map +1 -1
- package/dist/storage/domains/observability/feedback.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +13 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/logs.d.ts.map +1 -1
- package/dist/storage/domains/observability/metrics.d.ts.map +1 -1
- package/dist/storage/domains/observability/migration.d.ts +19 -0
- package/dist/storage/domains/observability/migration.d.ts.map +1 -0
- package/dist/storage/domains/observability/scores.d.ts.map +1 -1
- package/dist/storage/domains/observability/tracing.d.ts +3 -1
- package/dist/storage/domains/observability/tracing.d.ts.map +1 -1
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +12 -12
- package/dist/observability-IME6BI7N.cjs.map +0 -1
- package/dist/observability-J4YTASAF.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,70 @@
|
|
|
1
1
|
# @mastra/duckdb
|
|
2
2
|
|
|
3
|
-
## 0.0.0-studio-
|
|
3
|
+
## 0.0.0-studio-cli-20260504022012
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @mastra/core@0.0.0-studio-
|
|
7
|
+
- Updated dependencies [[`6dcd65f`](https://github.com/mastra-ai/mastra/commit/6dcd65f2a34069e6dc43ba35f1d11119b9b40bef), [`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`1c2dda8`](https://github.com/mastra-ai/mastra/commit/1c2dda805fbfccc0abf55d4cb20cc34402dc3f0c), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d)]:
|
|
8
|
+
- @mastra/core@0.0.0-studio-cli-20260504022012
|
|
9
|
+
|
|
10
|
+
## 1.2.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- Added unique IDs (`logId`, `metricId`, `scoreId`, `feedbackId`) to all observability signals, generated automatically at emission time for de-duplication across the framework pipeline and cross-system correlation. User-facing APIs (`logger.info()`, `metrics.emit()`, `addScore()`, `addFeedback()`) are unchanged. ([#15242](https://github.com/mastra-ai/mastra/pull/15242))
|
|
15
|
+
|
|
16
|
+
For existing ClickHouse and DuckDB observability signal tables, run `npx mastra migrate` before initializing the store so the new signal-ID schema is applied.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fixed DuckDB installs by using a resolvable @duckdb/node-api version range. ([#15419](https://github.com/mastra-ai/mastra/pull/15419))
|
|
21
|
+
|
|
22
|
+
- Added `getTraceLight` method to the observability storage, returning only lightweight span fields needed for timeline rendering. This avoids transferring heavy fields like `input`, `output`, `attributes`, and `metadata` when they are not needed. ([#15574](https://github.com/mastra-ai/mastra/pull/15574))
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`20f59b8`](https://github.com/mastra-ai/mastra/commit/20f59b876cf91199efbc49a0e36b391240708f08), [`aba393e`](https://github.com/mastra-ai/mastra/commit/aba393e2da7390c69b80e516a4f153cda6f09376), [`3d83d06`](https://github.com/mastra-ai/mastra/commit/3d83d06f776f00fb5f4163dddd32a030c5c20844), [`e2687a7`](https://github.com/mastra-ai/mastra/commit/e2687a7408790c384563816a9a28ed06735684c9), [`fdd54cf`](https://github.com/mastra-ai/mastra/commit/fdd54cf612a9af876e9fdd85e534454f6e7dd518), [`6315317`](https://github.com/mastra-ai/mastra/commit/63153175fe9a7b224e5be7c209bbebc01dd9b0d5), [`a371ac5`](https://github.com/mastra-ai/mastra/commit/a371ac534aa1bb368a1acf9d8b313378dfdc787e), [`0474c2b`](https://github.com/mastra-ai/mastra/commit/0474c2b2e7c7e1ad8691dca031284841391ff1ef), [`0a5fa1d`](https://github.com/mastra-ai/mastra/commit/0a5fa1d3cb0583889d06687155f26fd7d2edc76c), [`7e0e63e`](https://github.com/mastra-ai/mastra/commit/7e0e63e2e485e84442351f4c7a79a424c83539dc), [`ea43e64`](https://github.com/mastra-ai/mastra/commit/ea43e646dd95d507694b6112b0bf1df22ad552b2), [`f607106`](https://github.com/mastra-ai/mastra/commit/f607106854c6416c4a07d4082604b9f66d047221), [`30456b6`](https://github.com/mastra-ai/mastra/commit/30456b6b08c8fd17e109dd093b73d93b65e83bc5), [`9d11a8c`](https://github.com/mastra-ai/mastra/commit/9d11a8c1c8924eb975a245a5884d40ca1b7e0491), [`9d3b24b`](https://github.com/mastra-ai/mastra/commit/9d3b24b19407ae9c09586cf7766d38dc4dff4a69), [`00d1b16`](https://github.com/mastra-ai/mastra/commit/00d1b16b401199cb294fa23f43336547db4dca9b), [`47cee3e`](https://github.com/mastra-ai/mastra/commit/47cee3e137fe39109cf7fffd2a8cf47b76dc702e), [`62919a6`](https://github.com/mastra-ai/mastra/commit/62919a6ee0fbf3779ad21a97b1ec6696515d5104), [`d246696`](https://github.com/mastra-ai/mastra/commit/d246696139a3144a5b21b042d41c532688e957e1), [`354f9ce`](https://github.com/mastra-ai/mastra/commit/354f9ce1ca6af2074b6a196a23f8ec30012dccca), [`16e34ca`](https://github.com/mastra-ai/mastra/commit/16e34caa98b9a114b17a6125e4e3fd87f169d0d0), [`7020c06`](https://github.com/mastra-ai/mastra/commit/7020c0690b199d9da337f0e805f16948e557922e), [`8786a61`](https://github.com/mastra-ai/mastra/commit/8786a61fa54ba265f85eeff9985ca39863d18bb6), [`9467ea8`](https://github.com/mastra-ai/mastra/commit/9467ea87695749a53dfc041576410ebf9ee7bb67), [`7338d94`](https://github.com/mastra-ai/mastra/commit/7338d949380cf68b095342e8e42610dc51d557c1), [`c80dc16`](https://github.com/mastra-ai/mastra/commit/c80dc16e113e6cc159f510ffde501ad4711b2189), [`af8a57e`](https://github.com/mastra-ai/mastra/commit/af8a57ed9ba9685ad8601d5b71ae3706da6222f9), [`d63ffdb`](https://github.com/mastra-ai/mastra/commit/d63ffdbb2c11e76fe5ea45faab44bc15460f010c), [`47cee3e`](https://github.com/mastra-ai/mastra/commit/47cee3e137fe39109cf7fffd2a8cf47b76dc702e), [`1bd5104`](https://github.com/mastra-ai/mastra/commit/1bd51048b6da93507276d6623e3fd96a9e1a8944), [`e9837b5`](https://github.com/mastra-ai/mastra/commit/e9837b53699e18711b09e0ca010a4106376f2653), [`8f1b280`](https://github.com/mastra-ai/mastra/commit/8f1b280b7fe6999ec654f160cb69c1a8719e7a57), [`92dcf02`](https://github.com/mastra-ai/mastra/commit/92dcf029294210ac91b090900c1a0555a425c57a), [`0fd90a2`](https://github.com/mastra-ai/mastra/commit/0fd90a215caf5fca8099c15a67ca03e4427747a3), [`8fb2405`](https://github.com/mastra-ai/mastra/commit/8fb2405138f2d208b7962ad03f121ca25bcc28c5), [`12df98c`](https://github.com/mastra-ai/mastra/commit/12df98c4904643d9481f5c78f3bed443725b4c96)]:
|
|
25
|
+
- @mastra/core@1.26.0
|
|
26
|
+
|
|
27
|
+
## 1.2.0-alpha.1
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- Added unique IDs (`logId`, `metricId`, `scoreId`, `feedbackId`) to all observability signals, generated automatically at emission time for de-duplication across the framework pipeline and cross-system correlation. User-facing APIs (`logger.info()`, `metrics.emit()`, `addScore()`, `addFeedback()`) are unchanged. ([#15242](https://github.com/mastra-ai/mastra/pull/15242))
|
|
32
|
+
|
|
33
|
+
For existing ClickHouse and DuckDB observability signal tables, run `npx mastra migrate` before initializing the store so the new signal-ID schema is applied.
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Added `getTraceLight` method to the observability storage, returning only lightweight span fields needed for timeline rendering. This avoids transferring heavy fields like `input`, `output`, `attributes`, and `metadata` when they are not needed. ([#15574](https://github.com/mastra-ai/mastra/pull/15574))
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [[`20f59b8`](https://github.com/mastra-ai/mastra/commit/20f59b876cf91199efbc49a0e36b391240708f08), [`e2687a7`](https://github.com/mastra-ai/mastra/commit/e2687a7408790c384563816a9a28ed06735684c9), [`8f1b280`](https://github.com/mastra-ai/mastra/commit/8f1b280b7fe6999ec654f160cb69c1a8719e7a57), [`12df98c`](https://github.com/mastra-ai/mastra/commit/12df98c4904643d9481f5c78f3bed443725b4c96)]:
|
|
40
|
+
- @mastra/core@1.26.0-alpha.11
|
|
41
|
+
|
|
42
|
+
## 1.1.3-alpha.0
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Fixed DuckDB installs by using a resolvable @duckdb/node-api version range. ([#15419](https://github.com/mastra-ai/mastra/pull/15419))
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`fdd54cf`](https://github.com/mastra-ai/mastra/commit/fdd54cf612a9af876e9fdd85e534454f6e7dd518), [`30456b6`](https://github.com/mastra-ai/mastra/commit/30456b6b08c8fd17e109dd093b73d93b65e83bc5), [`9d11a8c`](https://github.com/mastra-ai/mastra/commit/9d11a8c1c8924eb975a245a5884d40ca1b7e0491), [`d246696`](https://github.com/mastra-ai/mastra/commit/d246696139a3144a5b21b042d41c532688e957e1), [`354f9ce`](https://github.com/mastra-ai/mastra/commit/354f9ce1ca6af2074b6a196a23f8ec30012dccca), [`e9837b5`](https://github.com/mastra-ai/mastra/commit/e9837b53699e18711b09e0ca010a4106376f2653)]:
|
|
49
|
+
- @mastra/core@1.26.0-alpha.3
|
|
50
|
+
|
|
51
|
+
## 1.1.2
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Added `entityVersionId`, `parentEntityVersionId`, and `rootEntityVersionId` columns to observability storage tables (spans, metrics, scores, feedback, logs) for filtering and grouping traces by entity version. Added ALTER TABLE migrations for existing databases. Added `targetType`, `targetId`, `agentVersion`, and `status` filters to `listExperiments`, and `traceId` and `status` filters to `listExperimentResults`. ([#15317](https://github.com/mastra-ai/mastra/pull/15317))
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`87df955`](https://github.com/mastra-ai/mastra/commit/87df955c028660c075873fd5d74af28233ce32eb), [`8fad147`](https://github.com/mastra-ai/mastra/commit/8fad14759804179c8e080ce4d9dec6ef1a808b31), [`582644c`](https://github.com/mastra-ai/mastra/commit/582644c4a87f83b4f245a84d72b9e8590585012e), [`cbdf3e1`](https://github.com/mastra-ai/mastra/commit/cbdf3e12b3d0c30a6e5347be658e2009648c130a), [`8fe46d3`](https://github.com/mastra-ai/mastra/commit/8fe46d354027f3f0f0846e64219772348de106dd), [`18c67db`](https://github.com/mastra-ai/mastra/commit/18c67dbb9c9ebc26f26f65f7d3ff836e5691ef46), [`4ba3bb1`](https://github.com/mastra-ai/mastra/commit/4ba3bb1e465ad2ddaba3bbf2bc47e0faec32985e), [`5d84914`](https://github.com/mastra-ai/mastra/commit/5d84914e0e520c642a40329b210b413fcd139898), [`8dcc77e`](https://github.com/mastra-ai/mastra/commit/8dcc77e78a5340f5848f74b9e9f1b3da3513c1f5), [`aa67fc5`](https://github.com/mastra-ai/mastra/commit/aa67fc59ee8a5eeff1f23eb05970b8d7a536c8ff), [`fd2f314`](https://github.com/mastra-ai/mastra/commit/fd2f31473d3449b6b97e837ef8641264377f41a7), [`fa8140b`](https://github.com/mastra-ai/mastra/commit/fa8140bcd4251d2e3ac85fdc5547dfc4f372b5be), [`190f452`](https://github.com/mastra-ai/mastra/commit/190f45258b0640e2adfc8219fa3258cdc5b8f071), [`e80fead`](https://github.com/mastra-ai/mastra/commit/e80fead1412cc0d1b2f7d6a1ce5017d9e0098ff7), [`0287b64`](https://github.com/mastra-ai/mastra/commit/0287b644a5c3272755cf3112e71338106664103b), [`7e7bf60`](https://github.com/mastra-ai/mastra/commit/7e7bf606886bf374a6f9d4ca9b09dd83d0533372), [`184907d`](https://github.com/mastra-ai/mastra/commit/184907d775d8609c03c26e78ccaf37315f3aa287), [`075e91a`](https://github.com/mastra-ai/mastra/commit/075e91a4549baf46ad7a42a6a8ac8dfa78cc09e6), [`0c4cd13`](https://github.com/mastra-ai/mastra/commit/0c4cd131931c04ac5405373c932a242dbe88edd6), [`b16a753`](https://github.com/mastra-ai/mastra/commit/b16a753d5748440248d7df82e29bb987a9c8386c)]:
|
|
58
|
+
- @mastra/core@1.25.0
|
|
59
|
+
|
|
60
|
+
## 1.1.2-alpha.0
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Added `entityVersionId`, `parentEntityVersionId`, and `rootEntityVersionId` columns to observability storage tables (spans, metrics, scores, feedback, logs) for filtering and grouping traces by entity version. Added ALTER TABLE migrations for existing databases. Added `targetType`, `targetId`, `agentVersion`, and `status` filters to `listExperiments`, and `traceId` and `status` filters to `listExperimentResults`. ([#15317](https://github.com/mastra-ai/mastra/pull/15317))
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`cbdf3e1`](https://github.com/mastra-ai/mastra/commit/cbdf3e12b3d0c30a6e5347be658e2009648c130a), [`8fe46d3`](https://github.com/mastra-ai/mastra/commit/8fe46d354027f3f0f0846e64219772348de106dd), [`18c67db`](https://github.com/mastra-ai/mastra/commit/18c67dbb9c9ebc26f26f65f7d3ff836e5691ef46), [`8dcc77e`](https://github.com/mastra-ai/mastra/commit/8dcc77e78a5340f5848f74b9e9f1b3da3513c1f5), [`aa67fc5`](https://github.com/mastra-ai/mastra/commit/aa67fc59ee8a5eeff1f23eb05970b8d7a536c8ff), [`fa8140b`](https://github.com/mastra-ai/mastra/commit/fa8140bcd4251d2e3ac85fdc5547dfc4f372b5be), [`190f452`](https://github.com/mastra-ai/mastra/commit/190f45258b0640e2adfc8219fa3258cdc5b8f071), [`7e7bf60`](https://github.com/mastra-ai/mastra/commit/7e7bf606886bf374a6f9d4ca9b09dd83d0533372), [`184907d`](https://github.com/mastra-ai/mastra/commit/184907d775d8609c03c26e78ccaf37315f3aa287), [`0c4cd13`](https://github.com/mastra-ai/mastra/commit/0c4cd131931c04ac5405373c932a242dbe88edd6), [`b16a753`](https://github.com/mastra-ai/mastra/commit/b16a753d5748440248d7df82e29bb987a9c8386c)]:
|
|
67
|
+
- @mastra/core@1.25.0-alpha.3
|
|
9
68
|
|
|
10
69
|
## 1.1.1
|
|
11
70
|
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-duckdb
|
|
|
3
3
|
description: Documentation for @mastra/duckdb. Use when working with @mastra/duckdb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/duckdb"
|
|
6
|
-
version: "0.0.0-studio-
|
|
6
|
+
version: "0.0.0-studio-cli-20260504022012"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -16,6 +16,7 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
16
16
|
|
|
17
17
|
### Reference
|
|
18
18
|
|
|
19
|
+
- [Reference: DuckDB storage](references/reference-storage-duckdb.md) - Documentation for the DuckDB storage implementation in Mastra, an embedded analytical backend for local observability development.
|
|
19
20
|
- [Reference: DuckDB vector store](references/reference-vectors-duckdb.md) - Documentation for the DuckDBVector class in Mastra, which provides embedded high-performance vector search using DuckDB with HNSW indexing.
|
|
20
21
|
|
|
21
22
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# DuckDB storage
|
|
2
|
+
|
|
3
|
+
[DuckDB](https://duckdb.org/) is an embedded, in-process analytical database. The `@mastra/duckdb` package provides an OLAP-backed observability store for local development, suitable for traces, logs, metrics, scores, and feedback without running an external service.
|
|
4
|
+
|
|
5
|
+
For vector search, see the [DuckDB vector store reference](https://mastra.ai/reference/vectors/duckdb), which is a separate API in the same package.
|
|
6
|
+
|
|
7
|
+
## When to use DuckDB
|
|
8
|
+
|
|
9
|
+
Local development of observability features. DuckDB is embedded and file-based, so it does not require a server and starts instantly. It supports the same observability signals as ClickHouse, which makes it useful for testing dashboards and trace exploration before deploying to a production backend.
|
|
10
|
+
|
|
11
|
+
DuckDB currently implements only the `observability` domain. Pair it with another storage adapter (such as [LibSQL](https://mastra.ai/reference/storage/libsql)) for `memory` and `workflows` in a [composite storage](https://mastra.ai/reference/storage/composite) setup.
|
|
12
|
+
|
|
13
|
+
> **Warning:** DuckDB is for development and not recommended for production. It runs in-process, persists to a single local file, and does not work on platforms with ephemeral filesystems (such as Railway, Fly.io, Render, Heroku, or serverless containers). For production observability, use [ClickHouse](https://mastra.ai/reference/storage/clickhouse).
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
**npm**:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @mastra/duckdb@latest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**pnpm**:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm add @mastra/duckdb@latest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Yarn**:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
yarn add @mastra/duckdb@latest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Bun**:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bun add @mastra/duckdb@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### As the observability domain in a composite store
|
|
44
|
+
|
|
45
|
+
This is the standard local-development setup. LibSQL handles the other domains, and DuckDB handles observability.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Mastra } from '@mastra/core'
|
|
49
|
+
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
50
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
51
|
+
import { DuckDBStore } from '@mastra/duckdb'
|
|
52
|
+
import { Observability, DefaultExporter } from '@mastra/observability'
|
|
53
|
+
|
|
54
|
+
export const mastra = new Mastra({
|
|
55
|
+
storage: new MastraCompositeStore({
|
|
56
|
+
id: 'composite-storage',
|
|
57
|
+
default: new LibSQLStore({
|
|
58
|
+
id: 'mastra-storage',
|
|
59
|
+
url: 'file:./mastra.db',
|
|
60
|
+
}),
|
|
61
|
+
domains: {
|
|
62
|
+
observability: new DuckDBStore().observability,
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
observability: new Observability({
|
|
66
|
+
configs: {
|
|
67
|
+
default: {
|
|
68
|
+
serviceName: 'mastra',
|
|
69
|
+
exporters: [new DefaultExporter()],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The `.observability` accessor returns the observability domain store directly. The equivalent generic form uses `getStore()`, which works for any composite-style storage adapter:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const observability = await new DuckDBStore().getStore('observability')
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Standalone
|
|
83
|
+
|
|
84
|
+
When you need only observability storage outside the `Mastra` composite, instantiate `DuckDBStore` directly and access the observability domain:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { DuckDBStore } from '@mastra/duckdb'
|
|
88
|
+
|
|
89
|
+
const duckdb = new DuckDBStore({ path: './traces.duckdb' })
|
|
90
|
+
const observability = duckdb.observability
|
|
91
|
+
|
|
92
|
+
await observability.init()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### In-memory database
|
|
96
|
+
|
|
97
|
+
Pass `:memory:` to use an ephemeral DuckDB instance. Data is lost when the process exits, which is appropriate for unit tests and short-lived scripts.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
const duckdb = new DuckDBStore({ path: ':memory:' })
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Configuration
|
|
104
|
+
|
|
105
|
+
### `DuckDBStore` options
|
|
106
|
+
|
|
107
|
+
**id** (`string`): Unique identifier for this storage instance. (Default: `'duckdb'`)
|
|
108
|
+
|
|
109
|
+
**path** (`string`): Path to the DuckDB database file. Use \`:memory:\` for an ephemeral in-memory database. (Default: `'mastra.duckdb'`)
|
|
110
|
+
|
|
111
|
+
### Lower-level types
|
|
112
|
+
|
|
113
|
+
`@mastra/duckdb` also exports `DuckDBConnection` for sharing a single underlying database across multiple Mastra storage instances, and the corresponding `DuckDBStorageConfig` type. Most applications will not need these directly.
|
|
114
|
+
|
|
115
|
+
## Supported domains
|
|
116
|
+
|
|
117
|
+
DuckDB currently implements one storage domain:
|
|
118
|
+
|
|
119
|
+
| Domain | Supported |
|
|
120
|
+
| --------------- | --------- |
|
|
121
|
+
| `observability` | Yes |
|
|
122
|
+
| `memory` | No |
|
|
123
|
+
| `workflows` | No |
|
|
124
|
+
| `scores` | No |
|
|
125
|
+
| `agents` | No |
|
|
126
|
+
|
|
127
|
+
For a full storage solution, compose `DuckDBStore` with an adapter that covers the missing domains (most commonly [LibSQL](https://mastra.ai/reference/storage/libsql) for local development).
|
|
128
|
+
|
|
129
|
+
## Initialization
|
|
130
|
+
|
|
131
|
+
When passed to `Mastra` through `MastraCompositeStore`, the observability domain initializes itself on first use. To run initialization explicitly outside of `Mastra`, call `init()` on the observability store:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { DuckDBStore } from '@mastra/duckdb'
|
|
135
|
+
|
|
136
|
+
const duckdb = new DuckDBStore({ path: './traces.duckdb' })
|
|
137
|
+
await duckdb.observability.init()
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Observability strategy
|
|
141
|
+
|
|
142
|
+
DuckDB supports the `event-sourced` strategy used by `DefaultExporter`, which buffers spans in memory and writes completed events in batches. This is appropriate for development-scale traffic. For high-volume production workloads, see [`DefaultExporter` storage provider support](https://mastra.ai/docs/observability/tracing/exporters/default).
|
|
143
|
+
|
|
144
|
+
## Related
|
|
145
|
+
|
|
146
|
+
- [Storage overview](https://mastra.ai/reference/storage/overview)
|
|
147
|
+
- [Composite storage](https://mastra.ai/reference/storage/composite)
|
|
148
|
+
- [ClickHouse storage](https://mastra.ai/reference/storage/clickhouse): Production observability backend
|
|
149
|
+
- [DuckDB vector store](https://mastra.ai/reference/vectors/duckdb): Vector search using the same package
|
|
150
|
+
- [Observability overview](https://mastra.ai/docs/observability/overview)
|
package/dist/index.cjs
CHANGED
|
@@ -583,7 +583,7 @@ var ObservabilityStorageDuckDB = class extends storage.ObservabilityStorage {
|
|
|
583
583
|
return null;
|
|
584
584
|
}
|
|
585
585
|
if (!this.loadPromise) {
|
|
586
|
-
this.loadPromise = import('./observability-
|
|
586
|
+
this.loadPromise = import('./observability-AILZGFQT.cjs').then(({ ObservabilityStorageDuckDB: ObservabilityStorageDuckDB2 }) => {
|
|
587
587
|
const delegate = new ObservabilityStorageDuckDB2({ db: this.db });
|
|
588
588
|
this.delegate = delegate;
|
|
589
589
|
return delegate;
|
|
@@ -620,6 +620,10 @@ var ObservabilityStorageDuckDB = class extends storage.ObservabilityStorage {
|
|
|
620
620
|
}
|
|
621
621
|
return delegate.init(...args);
|
|
622
622
|
}
|
|
623
|
+
async migrateSpans(...args) {
|
|
624
|
+
const delegate = await this.requireDelegate();
|
|
625
|
+
return delegate.migrateSpans(...args);
|
|
626
|
+
}
|
|
623
627
|
async dangerouslyClearAll(...args) {
|
|
624
628
|
const delegate = await this.requireDelegate();
|
|
625
629
|
return delegate.dangerouslyClearAll(...args);
|
|
@@ -644,6 +648,10 @@ var ObservabilityStorageDuckDB = class extends storage.ObservabilityStorage {
|
|
|
644
648
|
const delegate = await this.requireDelegate();
|
|
645
649
|
return delegate.getTrace(...args);
|
|
646
650
|
}
|
|
651
|
+
async getTraceLight(...args) {
|
|
652
|
+
const delegate = await this.requireDelegate();
|
|
653
|
+
return delegate.getTraceLight(...args);
|
|
654
|
+
}
|
|
647
655
|
async listTraces(...args) {
|
|
648
656
|
const delegate = await this.requireDelegate();
|
|
649
657
|
return delegate.listTraces(...args);
|