@mastra/duckdb 1.1.0-alpha.3 → 1.1.1-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/CHANGELOG.md +73 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{observability-XVQ3ST7G.cjs → observability-IME6BI7N.cjs} +9 -7
- package/dist/observability-IME6BI7N.cjs.map +1 -0
- package/dist/{observability-VLTZBPVZ.js → observability-J4YTASAF.js} +9 -7
- package/dist/observability-J4YTASAF.js.map +1 -0
- package/dist/storage/domains/observability/ddl.d.ts +2 -2
- package/dist/storage/domains/observability/ddl.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/observability-VLTZBPVZ.js.map +0 -1
- package/dist/observability-XVQ3ST7G.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# @mastra/duckdb
|
|
2
2
|
|
|
3
|
+
## 1.1.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed DuckDB observability migrations to support nullable score and feedback trace IDs on existing installs. ([#14942](https://github.com/mastra-ai/mastra/pull/14942))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`ec5c319`](https://github.com/mastra-ai/mastra/commit/ec5c3197a50d034cb8e9cc494eebfddc684b5d81), [`6517789`](https://github.com/mastra-ai/mastra/commit/65177895b74b5471fe2245c7292f0176d9b3385d), [`9ad6aa6`](https://github.com/mastra-ai/mastra/commit/9ad6aa6dfe858afc6955d1df5f3f78c40bb96b9c), [`2862127`](https://github.com/mastra-ai/mastra/commit/2862127d0a7cbd28523120ad64fea067a95838e6), [`3d16814`](https://github.com/mastra-ai/mastra/commit/3d16814c395931373543728994ff45ac98093074), [`7f498d0`](https://github.com/mastra-ai/mastra/commit/7f498d099eacef64fd43ee412e3bd6f87965a8a6), [`8cf8a67`](https://github.com/mastra-ai/mastra/commit/8cf8a67b061b737cb06d501fb8c1967a98bbf3cb), [`d7827e3`](https://github.com/mastra-ai/mastra/commit/d7827e393937c6cb0c7a744dde4d31538cb542b7)]:
|
|
10
|
+
- @mastra/core@1.21.0-alpha.2
|
|
11
|
+
|
|
12
|
+
## 1.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Added DuckDB-backed observability queries for score and feedback analytics, including aggregates like counts and averages, breakdowns by dimensions such as model or environment, time-series over fixed intervals, and percentile calculations like p50 and p95. ([#14861](https://github.com/mastra-ai/mastra/pull/14861))
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
const result = await store.observability.getScorePercentiles({
|
|
20
|
+
scorerId: 'relevance',
|
|
21
|
+
percentiles: [0.5, 0.95],
|
|
22
|
+
interval: '1h',
|
|
23
|
+
});
|
|
24
|
+
// { series: [{ percentile: 0.5, points: [{ timestamp, value }] }, ...] }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Adds observability storage using DuckDB for traces, metrics, logs, scores, and feedback. Exports `DuckDBStore`, `ObservabilityStorageDuckDB`, and `DuckDBConnection`. ([#14249](https://github.com/mastra-ai/mastra/pull/14249))
|
|
28
|
+
|
|
29
|
+
Older `@mastra/core` versions show an upgrade error when you use the DuckDB observability store.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
33
|
+
import { DefaultExporter, Observability } from '@mastra/observability';
|
|
34
|
+
import { MastraCompositeStore } from '@mastra/core/storage';
|
|
35
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
36
|
+
import { DuckDBStore } from '@mastra/duckdb';
|
|
37
|
+
|
|
38
|
+
const duckDBStore = new DuckDBStore();
|
|
39
|
+
const libSqlStore = new LibSQLStore();
|
|
40
|
+
|
|
41
|
+
const storage = new MastraCompositeStore({
|
|
42
|
+
id: 'composite',
|
|
43
|
+
domains: {
|
|
44
|
+
...libSqlStore.stores,
|
|
45
|
+
observability: duckDBStore.observability,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const mastra = new Mastra({
|
|
50
|
+
agents: {
|
|
51
|
+
/* your agents here */
|
|
52
|
+
},
|
|
53
|
+
observability: new Observability({
|
|
54
|
+
configs: {
|
|
55
|
+
default: {
|
|
56
|
+
serviceName: 'obs-test',
|
|
57
|
+
exporters: [new DefaultExporter()],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
storage,
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- Updated DuckDB observability storage to support the current Mastra observability fields for logs, metrics, scores, and feedback. ([#14851](https://github.com/mastra-ai/mastra/pull/14851))
|
|
66
|
+
|
|
67
|
+
Scores and feedback stored in DuckDB now include the new correlation data used across Mastra observability.
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Fixed `'Cannot create values of type ANY'` error when querying metrics endpoints with DuckDB. Parameter binding now uses explicit typed methods instead of relying on DuckDB's type inference, which fails for certain SQL contexts like `json_extract_string`. ([#14666](https://github.com/mastra-ai/mastra/pull/14666))
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [[`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067), [`e333b77`](https://github.com/mastra-ai/mastra/commit/e333b77e2d76ba57ccec1818e08cebc1993469ff), [`dc9fc19`](https://github.com/mastra-ai/mastra/commit/dc9fc19da4437f6b508cc355f346a8856746a76b), [`60a224d`](https://github.com/mastra-ai/mastra/commit/60a224dd497240e83698cfa5bfd02e3d1d854844), [`fbf22a7`](https://github.com/mastra-ai/mastra/commit/fbf22a7ad86bcb50dcf30459f0d075e51ddeb468), [`f16d92c`](https://github.com/mastra-ai/mastra/commit/f16d92c677a119a135cebcf7e2b9f51ada7a9df4), [`949b7bf`](https://github.com/mastra-ai/mastra/commit/949b7bfd4e40f2b2cba7fef5eb3f108a02cfe938), [`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`12c647c`](https://github.com/mastra-ai/mastra/commit/12c647cf3a26826eb72d40b42e3c8356ceae16ed), [`d084b66`](https://github.com/mastra-ai/mastra/commit/d084b6692396057e83c086b954c1857d20b58a14), [`79c699a`](https://github.com/mastra-ai/mastra/commit/79c699acf3cd8a77e11c55530431f48eb48456e9), [`62757b6`](https://github.com/mastra-ai/mastra/commit/62757b6db6e8bb86569d23ad0b514178f57053f8), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`819f03c`](https://github.com/mastra-ai/mastra/commit/819f03c25823373b32476413bd76be28a5d8705a), [`04160ee`](https://github.com/mastra-ai/mastra/commit/04160eedf3130003cf842ad08428c8ff69af4cc1), [`2c27503`](https://github.com/mastra-ai/mastra/commit/2c275032510d131d2cde47f99953abf0fe02c081), [`424a1df`](https://github.com/mastra-ai/mastra/commit/424a1df7bee59abb5c83717a54807fdd674a6224), [`3d70b0b`](https://github.com/mastra-ai/mastra/commit/3d70b0b3524d817173ad870768f259c06d61bd23), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`260fe12`](https://github.com/mastra-ai/mastra/commit/260fe1295fe7354e39d6def2775e0797a7a277f0), [`12c88a6`](https://github.com/mastra-ai/mastra/commit/12c88a6e32bf982c2fe0c6af62e65a3414519a75), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`78670e9`](https://github.com/mastra-ai/mastra/commit/78670e97e76d7422cf7025faf371b2aeafed860d), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778), [`3b45a13`](https://github.com/mastra-ai/mastra/commit/3b45a138d09d040779c0aba1edbbfc1b57442d23), [`d400e7c`](https://github.com/mastra-ai/mastra/commit/d400e7c8b8d7afa6ba2c71769eace4048e3cef8e), [`f58d1a7`](https://github.com/mastra-ai/mastra/commit/f58d1a7a457588a996c3ecb53201a68f3d28c432), [`a49a929`](https://github.com/mastra-ai/mastra/commit/a49a92904968b4fc67e01effee8c7c8d0464ba85), [`8127d96`](https://github.com/mastra-ai/mastra/commit/8127d96280492e335d49b244501088dfdd59a8f1)]:
|
|
74
|
+
- @mastra/core@1.18.0
|
|
75
|
+
|
|
3
76
|
## 1.1.0-alpha.3
|
|
4
77
|
|
|
5
78
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
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-IME6BI7N.cjs').then(({ ObservabilityStorageDuckDB: ObservabilityStorageDuckDB2 }) => {
|
|
587
587
|
const delegate = new ObservabilityStorageDuckDB2({ db: this.db });
|
|
588
588
|
this.delegate = delegate;
|
|
589
589
|
return delegate;
|
package/dist/index.js
CHANGED
|
@@ -582,7 +582,7 @@ var ObservabilityStorageDuckDB = class extends ObservabilityStorage {
|
|
|
582
582
|
return null;
|
|
583
583
|
}
|
|
584
584
|
if (!this.loadPromise) {
|
|
585
|
-
this.loadPromise = import('./observability-
|
|
585
|
+
this.loadPromise = import('./observability-J4YTASAF.js').then(({ ObservabilityStorageDuckDB: ObservabilityStorageDuckDB2 }) => {
|
|
586
586
|
const delegate = new ObservabilityStorageDuckDB2({ db: this.db });
|
|
587
587
|
this.delegate = delegate;
|
|
588
588
|
return delegate;
|
|
@@ -149,7 +149,7 @@ CREATE TABLE IF NOT EXISTS score_events (
|
|
|
149
149
|
timestamp TIMESTAMP NOT NULL,
|
|
150
150
|
|
|
151
151
|
-- IDs
|
|
152
|
-
traceId VARCHAR
|
|
152
|
+
traceId VARCHAR,
|
|
153
153
|
spanId VARCHAR,
|
|
154
154
|
experimentId VARCHAR,
|
|
155
155
|
scoreTraceId VARCHAR,
|
|
@@ -196,7 +196,7 @@ CREATE TABLE IF NOT EXISTS feedback_events (
|
|
|
196
196
|
timestamp TIMESTAMP NOT NULL,
|
|
197
197
|
|
|
198
198
|
-- IDs
|
|
199
|
-
traceId VARCHAR
|
|
199
|
+
traceId VARCHAR,
|
|
200
200
|
spanId VARCHAR,
|
|
201
201
|
experimentId VARCHAR,
|
|
202
202
|
-- Entity hierarchy
|
|
@@ -306,6 +306,7 @@ var ALL_MIGRATIONS = [
|
|
|
306
306
|
`ALTER TABLE score_events ADD COLUMN IF NOT EXISTS scope JSON`,
|
|
307
307
|
`ALTER TABLE score_events ADD COLUMN IF NOT EXISTS source VARCHAR`,
|
|
308
308
|
`ALTER TABLE score_events ADD COLUMN IF NOT EXISTS scoreSource VARCHAR`,
|
|
309
|
+
`ALTER TABLE score_events ALTER COLUMN traceId DROP NOT NULL`,
|
|
309
310
|
// Feedback
|
|
310
311
|
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS entityType VARCHAR`,
|
|
311
312
|
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS entityId VARCHAR`,
|
|
@@ -330,7 +331,8 @@ var ALL_MIGRATIONS = [
|
|
|
330
331
|
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS tags JSON`,
|
|
331
332
|
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS scope JSON`,
|
|
332
333
|
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS source VARCHAR`,
|
|
333
|
-
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS feedbackSource VARCHAR
|
|
334
|
+
`ALTER TABLE feedback_events ADD COLUMN IF NOT EXISTS feedbackSource VARCHAR`,
|
|
335
|
+
`ALTER TABLE feedback_events ALTER COLUMN traceId DROP NOT NULL`
|
|
334
336
|
];
|
|
335
337
|
function unionDistinctQueries(selects, orderBy) {
|
|
336
338
|
return `${selects.join("\nUNION\n")}
|
|
@@ -688,7 +690,7 @@ function rowToFeedbackRecord(row) {
|
|
|
688
690
|
if (!isNaN(numValue)) value = numValue;
|
|
689
691
|
return {
|
|
690
692
|
timestamp: toDate(row.timestamp),
|
|
691
|
-
traceId: row.traceId,
|
|
693
|
+
traceId: row.traceId ?? null,
|
|
692
694
|
spanId: row.spanId ?? null,
|
|
693
695
|
experimentId: row.experimentId ?? null,
|
|
694
696
|
entityType: row.entityType ?? null,
|
|
@@ -1755,7 +1757,7 @@ function toSeriesName2(values) {
|
|
|
1755
1757
|
function rowToScoreRecord(row) {
|
|
1756
1758
|
return {
|
|
1757
1759
|
timestamp: toDate(row.timestamp),
|
|
1758
|
-
traceId: row.traceId,
|
|
1760
|
+
traceId: row.traceId ?? null,
|
|
1759
1761
|
spanId: row.spanId ?? null,
|
|
1760
1762
|
experimentId: row.experimentId ?? null,
|
|
1761
1763
|
scoreTraceId: row.scoreTraceId ?? null,
|
|
@@ -2529,5 +2531,5 @@ var ObservabilityStorageDuckDB = class extends storage.ObservabilityStorage {
|
|
|
2529
2531
|
};
|
|
2530
2532
|
|
|
2531
2533
|
exports.ObservabilityStorageDuckDB = ObservabilityStorageDuckDB;
|
|
2532
|
-
//# sourceMappingURL=observability-
|
|
2533
|
-
//# sourceMappingURL=observability-
|
|
2534
|
+
//# sourceMappingURL=observability-IME6BI7N.cjs.map
|
|
2535
|
+
//# sourceMappingURL=observability-IME6BI7N.cjs.map
|