@mastra/observability 1.13.0-alpha.0 → 1.13.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 +32 -0
- package/dist/exporters/default.d.ts.map +1 -1
- package/dist/exporters/mastra-storage.d.ts +2 -0
- package/dist/exporters/mastra-storage.d.ts.map +1 -1
- package/dist/index.cjs +65 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +65 -10
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @mastra/observability
|
|
2
2
|
|
|
3
|
+
## 1.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Roll up token usage from internal MODEL_GENERATION spans onto the closest exported ancestor span. When `tracingPolicy.internal` filters a model call out of exported traces, its tokens used to disappear from both the trace UI and metrics. Now: ([#16434](https://github.com/mastra-ai/mastra/pull/16434))
|
|
8
|
+
- The visible ancestor (e.g. `PROCESSOR_RUN`, `AGENT_RUN`) gets an `internalUsage` attribute summing the tokens consumed by its hidden descendants — so a Mastra-owned processor that runs an internal agent (moderation, PII detector, structured output, etc.) shows its aggregate cost on the visible `PROCESSOR_RUN` span.
|
|
9
|
+
- Token / cost metrics still emit, but are attributed via labels to the visible ancestor instead of the hidden agent.
|
|
10
|
+
|
|
11
|
+
No action required — the rollup applies automatically whenever an internal `MODEL_GENERATION` ends inside a non-internal ancestor.
|
|
12
|
+
|
|
13
|
+
- `MastraStorageExporter` now notifies custom exporters and connected integrations when it cannot persist observability events, such as unsupported storage or retries being exceeded. This matches the behavior already available on `DefaultExporter`. ([#16755](https://github.com/mastra-ai/mastra/pull/16755))
|
|
14
|
+
|
|
15
|
+
Also fixed an issue in both exporters where span updates waiting on their parent span could be silently lost if a later flush in the same cycle failed.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`452036a`](https://github.com/mastra-ai/mastra/commit/452036a0d965b4f4c1efd93606e4f03b50b807a5), [`c272d50`](https://github.com/mastra-ai/mastra/commit/c272d50610a54496b6b6d92ccd4d37b333a2613a), [`27fd1b7`](https://github.com/mastra-ai/mastra/commit/27fd1b79ac62eb7694f92587eb7d1be05b59be01), [`5ba7253`](https://github.com/mastra-ai/mastra/commit/5ba7253745c85e8df8012a76d954c640ffa336f7), [`5556cc1`](https://github.com/mastra-ai/mastra/commit/5556cc1befec71518d84f826b3bfe3a079a9daf7), [`f73980d`](https://github.com/mastra-ai/mastra/commit/f73980d651eb5f7f1ab20582de4615a1b6f10fce), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`a702009`](https://github.com/mastra-ai/mastra/commit/a702009d3cfaa745120f501e21c783ed4d6a3072), [`9aee493`](https://github.com/mastra-ai/mastra/commit/9aee493ed6089b5133472623dcce49934bf2d509), [`d8692af`](https://github.com/mastra-ai/mastra/commit/d8692afa253028e39cdce2aafa0ac414071a762e), [`1a9cc60`](https://github.com/mastra-ai/mastra/commit/1a9cc6069f9910fc3d59e4953ac8cd95d89ad6f5), [`8cdb86c`](https://github.com/mastra-ai/mastra/commit/8cdb86ceed1137bc2768e147dce85a0692b9fb26), [`8534d79`](https://github.com/mastra-ai/mastra/commit/8534d791fa1cb70fe1c19e2604c4b63cc10dd051), [`eda90c5`](https://github.com/mastra-ai/mastra/commit/eda90c5bfd7de11805ecc9f4552716c895fbaf78), [`a935b0a`](https://github.com/mastra-ai/mastra/commit/a935b0a0977ae3f196b33ec7621f528069c82db0), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`c78f8cd`](https://github.com/mastra-ai/mastra/commit/c78f8cd6222a86e6c60ae5210b6929ad5221b6fb), [`e146aad`](https://github.com/mastra-ai/mastra/commit/e146aadbba66c410ba0e74bac4c50135495cb8dd), [`ac79462`](https://github.com/mastra-ai/mastra/commit/ac79462b98f1062394c45093aa515b0766f27ee2), [`1a0ec78`](https://github.com/mastra-ai/mastra/commit/1a0ec789a26cae443744e9abbd62ed6ee676af39), [`e47bca7`](https://github.com/mastra-ai/mastra/commit/e47bca7b72866d3abd173b9f530ac4318113a8ff), [`afc004f`](https://github.com/mastra-ai/mastra/commit/afc004f5cc7e30697809e7021820b9f5881e6719), [`0031d0f`](https://github.com/mastra-ai/mastra/commit/0031d0f13831d7843ac5d498734a7d92862e2ce3), [`841a222`](https://github.com/mastra-ai/mastra/commit/841a222560d8c19238f8213713f30535cdd82284), [`64c1e0b`](https://github.com/mastra-ai/mastra/commit/64c1e0b35165c96b659818bd0177aa18794ef11f), [`40d83a9`](https://github.com/mastra-ai/mastra/commit/40d83a90d9be31a1b83e04649edb703eb7753e33), [`4e88dc6`](https://github.com/mastra-ai/mastra/commit/4e88dc6b89f154c0eae37221c8126be0c23c569f), [`19018f0`](https://github.com/mastra-ai/mastra/commit/19018f05722af74a5978781a7731a654b26f7f2a), [`19281c7`](https://github.com/mastra-ai/mastra/commit/19281c70424f757219782de16c2699743c5e04d0), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`d52b6fe`](https://github.com/mastra-ai/mastra/commit/d52b6fe1c56853eb38864baae0bbfa75cc739ccb), [`408be73`](https://github.com/mastra-ai/mastra/commit/408be73449dfab92b51eab8c6623b6c443debc25), [`359439b`](https://github.com/mastra-ai/mastra/commit/359439bb8c635e048176306828195f8297f50021), [`71a820b`](https://github.com/mastra-ai/mastra/commit/71a820b2353fa1406772c50760a3732058a8b337), [`1698f5e`](https://github.com/mastra-ai/mastra/commit/1698f5ec141d34f22a873efdb145ce3cdf848a5e)]:
|
|
20
|
+
- @mastra/core@1.36.0
|
|
21
|
+
|
|
22
|
+
## 1.13.0-alpha.1
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- `MastraStorageExporter` now notifies custom exporters and connected integrations when it cannot persist observability events, such as unsupported storage or retries being exceeded. This matches the behavior already available on `DefaultExporter`. ([#16755](https://github.com/mastra-ai/mastra/pull/16755))
|
|
27
|
+
|
|
28
|
+
Also fixed an issue in both exporters where span updates waiting on their parent span could be silently lost if a later flush in the same cycle failed.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`5556cc1`](https://github.com/mastra-ai/mastra/commit/5556cc1befec71518d84f826b3bfe3a079a9daf7), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`e47bca7`](https://github.com/mastra-ai/mastra/commit/e47bca7b72866d3abd173b9f530ac4318113a8ff), [`0031d0f`](https://github.com/mastra-ai/mastra/commit/0031d0f13831d7843ac5d498734a7d92862e2ce3), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`359439b`](https://github.com/mastra-ai/mastra/commit/359439bb8c635e048176306828195f8297f50021)]:
|
|
33
|
+
- @mastra/core@1.36.0-alpha.3
|
|
34
|
+
|
|
3
35
|
## 1.13.0-alpha.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/exporters/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EAId,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAwB,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AAS/G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC;;;;;;GAMG;AACH,UAAU,qBAAsB,SAAQ,kBAAkB;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;CAC5C;AA6BD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,YAAY;;IAC/C,IAAI,SAA2C;gBAgBnC,MAAM,GAAE,qBAA0B;IAiB9C;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDvD;;OAEG;IACH,OAAO,CAAC,WAAW;IAyBnB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;;;OAIG;YACW,kBAAkB;IAQhC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,QAAQ;IAsBhB;;;;OAIG;YACW,YAAY;IA6B1B;;;OAGG;YACW,gBAAgB;
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/exporters/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EAId,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAwB,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AAS/G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC;;;;;;GAMG;AACH,UAAU,qBAAsB,SAAQ,kBAAkB;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;CAC5C;AA6BD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,YAAY;;IAC/C,IAAI,SAA2C;gBAgBnC,MAAM,GAAE,qBAA0B;IAiB9C;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDvD;;OAEG;IACH,OAAO,CAAC,WAAW;IAyBnB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;;;OAIG;YACW,kBAAkB;IAQhC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,QAAQ;IAsBhB;;;;OAIG;YACW,YAAY;IA6B1B;;;OAGG;YACW,gBAAgB;IA0D9B;;;;;;;OAOG;YACW,WAAW;IAmHnB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAW7D;;;;OAIG;YACW,WAAW;IAOzB;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhD;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAYhC"}
|
|
@@ -37,6 +37,8 @@ export declare class MastraStorageExporter extends BaseExporter {
|
|
|
37
37
|
* Returns the flush promise when flushing so callers can await it.
|
|
38
38
|
*/
|
|
39
39
|
private handleBatchedFlush;
|
|
40
|
+
private sanitizeDropError;
|
|
41
|
+
private emitDrop;
|
|
40
42
|
/**
|
|
41
43
|
* Flush a batch of create events for a single signal type.
|
|
42
44
|
* On "not implemented" errors, disables the signal for future flushes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mastra-storage.d.ts","sourceRoot":"","sources":["../../src/exporters/mastra-storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,
|
|
1
|
+
{"version":3,"file":"mastra-storage.d.ts","sourceRoot":"","sources":["../../src/exporters/mastra-storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EAId,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAwB,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AAS/G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,4FAA4F;AAC5F,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;CAC5C;AA6BD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;;IACrD,IAAI,SAA6B;gBAgBrB,MAAM,GAAE,2BAAgC;IAiBpD;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDvD;;OAEG;IACH,OAAO,CAAC,WAAW;IAyBnB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;;;OAIG;YACW,kBAAkB;IAQhC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,QAAQ;IAsBhB;;;;OAIG;YACW,YAAY;IA6B1B;;;OAGG;YACW,gBAAgB;IA0D9B;;;;;;;OAOG;YACW,WAAW;IAmHnB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAW7D;;;;OAIG;YACW,WAAW;IAOzB;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhD;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAYhC"}
|
package/dist/index.cjs
CHANGED
|
@@ -16020,7 +16020,10 @@ var DefaultExporter = class extends BaseExporter {
|
|
|
16020
16020
|
deferredUpdates.length = 0;
|
|
16021
16021
|
this.emitDrop("tracing", "unsupported-storage", events.length + deferredCountAtEntry, error48);
|
|
16022
16022
|
} else {
|
|
16023
|
-
deferredUpdates.length
|
|
16023
|
+
const newlyDeferred = deferredUpdates.length - deferredCountAtEntry;
|
|
16024
|
+
if (newlyDeferred > 0) {
|
|
16025
|
+
deferredUpdates.splice(deferredUpdates.length - newlyDeferred, newlyDeferred);
|
|
16026
|
+
}
|
|
16024
16027
|
const dropped = this.#eventBuffer.reAddUpdates(events);
|
|
16025
16028
|
this.emitDrop("tracing", "retry-exhausted", dropped.length, error48);
|
|
16026
16029
|
}
|
|
@@ -16719,6 +16722,7 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16719
16722
|
#observabilityStorage;
|
|
16720
16723
|
#resolvedStrategy;
|
|
16721
16724
|
#flushTimer;
|
|
16725
|
+
#emitDropEvent;
|
|
16722
16726
|
// Signals whose storage methods threw "not implemented" — skip on future flushes
|
|
16723
16727
|
#unsupportedSignals = /* @__PURE__ */ new Set();
|
|
16724
16728
|
constructor(config2 = {}) {
|
|
@@ -16740,6 +16744,7 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16740
16744
|
async init(options) {
|
|
16741
16745
|
try {
|
|
16742
16746
|
this.#isInitializing = true;
|
|
16747
|
+
this.#emitDropEvent = options.emitDropEvent;
|
|
16743
16748
|
this.#storage = options.mastra?.getStorage();
|
|
16744
16749
|
if (!this.#storage) {
|
|
16745
16750
|
this.logger.warn("MastraStorageExporter disabled: Storage not available. Traces will not be persisted.");
|
|
@@ -16825,21 +16830,54 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16825
16830
|
this.scheduleFlush();
|
|
16826
16831
|
}
|
|
16827
16832
|
}
|
|
16833
|
+
sanitizeDropError(error48) {
|
|
16834
|
+
if (error48 instanceof error$1.MastraError) {
|
|
16835
|
+
return {
|
|
16836
|
+
id: error48.id,
|
|
16837
|
+
domain: String(error48.domain),
|
|
16838
|
+
message: error48.message
|
|
16839
|
+
};
|
|
16840
|
+
}
|
|
16841
|
+
if (error48 instanceof Error) {
|
|
16842
|
+
return { message: error48.message };
|
|
16843
|
+
}
|
|
16844
|
+
return { message: String(error48) };
|
|
16845
|
+
}
|
|
16846
|
+
emitDrop(signal, reason, count, error48) {
|
|
16847
|
+
if (count === 0) return;
|
|
16848
|
+
const dropEvent = {
|
|
16849
|
+
type: "drop",
|
|
16850
|
+
signal,
|
|
16851
|
+
reason,
|
|
16852
|
+
count,
|
|
16853
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
16854
|
+
exporterName: this.name,
|
|
16855
|
+
...this.#observabilityStorage ? { storageName: this.#observabilityStorage.constructor.name } : {},
|
|
16856
|
+
...error48 === void 0 ? {} : { error: this.sanitizeDropError(error48) }
|
|
16857
|
+
};
|
|
16858
|
+
this.#emitDropEvent?.(dropEvent);
|
|
16859
|
+
}
|
|
16828
16860
|
/**
|
|
16829
16861
|
* Flush a batch of create events for a single signal type.
|
|
16830
16862
|
* On "not implemented" errors, disables the signal for future flushes.
|
|
16831
16863
|
* On other errors, re-adds events to the buffer for retry.
|
|
16832
16864
|
*/
|
|
16833
16865
|
async flushCreates(signal, events, storageCall) {
|
|
16834
|
-
if (
|
|
16866
|
+
if (events.length === 0) return;
|
|
16867
|
+
if (this.#unsupportedSignals.has(signal)) {
|
|
16868
|
+
this.emitDrop(signal, "unsupported-storage", events.length);
|
|
16869
|
+
return;
|
|
16870
|
+
}
|
|
16835
16871
|
try {
|
|
16836
16872
|
await storageCall(events);
|
|
16837
16873
|
} catch (error48) {
|
|
16838
16874
|
if (error48 instanceof error$1.MastraError && error48.domain === error$1.ErrorDomain.MASTRA_OBSERVABILITY && error48.id.endsWith("_NOT_IMPLEMENTED")) {
|
|
16839
16875
|
this.logger.warn(error48.message);
|
|
16840
16876
|
this.#unsupportedSignals.add(signal);
|
|
16877
|
+
this.emitDrop(signal, "unsupported-storage", events.length, error48);
|
|
16841
16878
|
} else {
|
|
16842
|
-
this.#eventBuffer.reAddCreates(events);
|
|
16879
|
+
const dropped = this.#eventBuffer.reAddCreates(events);
|
|
16880
|
+
this.emitDrop(signal, "retry-exhausted", dropped.length, error48);
|
|
16843
16881
|
}
|
|
16844
16882
|
}
|
|
16845
16883
|
}
|
|
@@ -16848,7 +16886,12 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16848
16886
|
* When `isEnd` is true, successfully flushed spans are removed from tracking.
|
|
16849
16887
|
*/
|
|
16850
16888
|
async flushSpanUpdates(events, deferredUpdates, isEnd) {
|
|
16851
|
-
|
|
16889
|
+
const deferredCountAtEntry = deferredUpdates.length;
|
|
16890
|
+
if (events.length === 0) return;
|
|
16891
|
+
if (this.#unsupportedSignals.has("tracing")) {
|
|
16892
|
+
this.emitDrop("tracing", "unsupported-storage", events.length);
|
|
16893
|
+
return;
|
|
16894
|
+
}
|
|
16852
16895
|
const partials = [];
|
|
16853
16896
|
for (const event of events) {
|
|
16854
16897
|
const span = event.exportedSpan;
|
|
@@ -16872,9 +16915,15 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16872
16915
|
if (error48 instanceof error$1.MastraError && error48.domain === error$1.ErrorDomain.MASTRA_OBSERVABILITY && error48.id.endsWith("_NOT_IMPLEMENTED")) {
|
|
16873
16916
|
this.logger.warn(error48.message);
|
|
16874
16917
|
this.#unsupportedSignals.add("tracing");
|
|
16875
|
-
} else {
|
|
16876
16918
|
deferredUpdates.length = 0;
|
|
16877
|
-
this
|
|
16919
|
+
this.emitDrop("tracing", "unsupported-storage", events.length + deferredCountAtEntry, error48);
|
|
16920
|
+
} else {
|
|
16921
|
+
const newlyDeferred = deferredUpdates.length - deferredCountAtEntry;
|
|
16922
|
+
if (newlyDeferred > 0) {
|
|
16923
|
+
deferredUpdates.splice(deferredUpdates.length - newlyDeferred, newlyDeferred);
|
|
16924
|
+
}
|
|
16925
|
+
const dropped = this.#eventBuffer.reAddUpdates(events);
|
|
16926
|
+
this.emitDrop("tracing", "retry-exhausted", dropped.length, error48);
|
|
16878
16927
|
}
|
|
16879
16928
|
}
|
|
16880
16929
|
}
|
|
@@ -16950,17 +16999,17 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16950
16999
|
(events) => this.#observabilityStorage.batchCreateFeedback({ feedbacks: events.map((f) => storage.buildFeedbackRecord(f)) })
|
|
16951
17000
|
),
|
|
16952
17001
|
this.flushCreates(
|
|
16953
|
-
"
|
|
17002
|
+
"log",
|
|
16954
17003
|
createLogEvents,
|
|
16955
17004
|
(events) => this.#observabilityStorage.batchCreateLogs({ logs: events.map((l) => storage.buildLogRecord(l)) })
|
|
16956
17005
|
),
|
|
16957
17006
|
this.flushCreates(
|
|
16958
|
-
"
|
|
17007
|
+
"metric",
|
|
16959
17008
|
createMetricEvents,
|
|
16960
17009
|
(events) => this.#observabilityStorage.batchCreateMetrics({ metrics: events.map((m) => storage.buildMetricRecord(m)) })
|
|
16961
17010
|
),
|
|
16962
17011
|
this.flushCreates(
|
|
16963
|
-
"
|
|
17012
|
+
"score",
|
|
16964
17013
|
createScoreEvents,
|
|
16965
17014
|
(events) => this.#observabilityStorage.batchCreateScores({ scores: events.map((s) => storage.buildScoreRecord(s)) })
|
|
16966
17015
|
),
|
|
@@ -16974,7 +17023,13 @@ var MastraStorageExporter = class extends BaseExporter {
|
|
|
16974
17023
|
await this.flushSpanUpdates(updateSpanEvents, deferredUpdates, false);
|
|
16975
17024
|
await this.flushSpanUpdates(endSpanEvents, deferredUpdates, true);
|
|
16976
17025
|
if (deferredUpdates.length > 0) {
|
|
16977
|
-
this.#
|
|
17026
|
+
if (this.#unsupportedSignals.has("tracing")) {
|
|
17027
|
+
this.emitDrop("tracing", "unsupported-storage", deferredUpdates.length);
|
|
17028
|
+
deferredUpdates.length = 0;
|
|
17029
|
+
} else {
|
|
17030
|
+
const dropped = this.#eventBuffer.reAddUpdates(deferredUpdates);
|
|
17031
|
+
this.emitDrop("tracing", "retry-exhausted", dropped.length);
|
|
17032
|
+
}
|
|
16978
17033
|
}
|
|
16979
17034
|
const elapsed = Date.now() - startTime;
|
|
16980
17035
|
this.logger.debug("Batch flushed", {
|