@mastra/observability 1.24.0-alpha.4 → 1.24.0-alpha.5
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/bus/observability-bus.d.ts +2 -1
- package/dist/bus/observability-bus.d.ts.map +1 -1
- package/dist/bus/route-event.d.ts.map +1 -1
- package/dist/default.d.ts +4 -1
- package/dist/default.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +53 -53
- package/dist/docs/references/docs-observability-feedback.md +5 -7
- package/dist/docs/references/reference-observability-feedback.md +43 -14
- package/dist/docs/references/reference-observability-tracing-exporters-mastra-platform-exporter.md +19 -16
- package/dist/exporters/default.d.ts +4 -7
- package/dist/exporters/default.d.ts.map +1 -1
- package/dist/exporters/event-buffer.d.ts +5 -2
- package/dist/exporters/event-buffer.d.ts.map +1 -1
- package/dist/exporters/mastra-platform.d.ts +5 -1
- package/dist/exporters/mastra-platform.d.ts.map +1 -1
- package/dist/exporters/mastra-storage.d.ts +4 -7
- package/dist/exporters/mastra-storage.d.ts.map +1 -1
- package/dist/exporters/platform-resolved-record.d.ts +3 -0
- package/dist/exporters/platform-resolved-record.d.ts.map +1 -0
- package/dist/exporters/storage-annotation.d.ts +9 -0
- package/dist/exporters/storage-annotation.d.ts.map +1 -0
- package/dist/exporters/storage-byte-tracker.d.ts +2 -3
- package/dist/exporters/storage-byte-tracker.d.ts.map +1 -1
- package/dist/index.cjs +900 -730
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +900 -730
- package/dist/index.js.map +1 -1
- package/dist/instances/base.d.ts +2 -1
- package/dist/instances/base.d.ts.map +1 -1
- package/dist/recorded.d.ts +4 -12
- package/dist/recorded.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/docs/references/reference-observability-tracing-exporters-mastra-platform-exporter.md
CHANGED
|
@@ -37,7 +37,7 @@ interface MastraPlatformExporterConfig extends BaseExporterConfig {
|
|
|
37
37
|
uploadTimeoutMs?: number // Default: 30000
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/** Maximum retry attempts. Default: 3 */
|
|
40
|
+
/** Maximum retry attempts for collector batches. Default: 3 */
|
|
41
41
|
maxRetries?: number
|
|
42
42
|
|
|
43
43
|
/** Mastra Observability access token (from env or config) */
|
|
@@ -142,11 +142,9 @@ Every `MetricEvent` passed to this handler is buffered and exported to the metri
|
|
|
142
142
|
async onScoreEvent(event: ScoreEvent): Promise<void>
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
Schedules a score for export using the [feedback and score delivery](#feedback-and-score-delivery) behavior. Events are ignored when the exporter is disabled or shutdown has started. If Platform needs to look up the trace, a missing trace ID causes the record to be dropped.
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
**Returns:** `Promise<void>` after the score event has been accepted for buffering.
|
|
147
|
+
**Returns:** `Promise<void>` when the event has been scheduled or ignored. Call `flush()` to wait for pending deliveries, because this return value doesn't confirm delivery.
|
|
150
148
|
|
|
151
149
|
### `onFeedbackEvent`
|
|
152
150
|
|
|
@@ -154,11 +152,9 @@ Every `ScoreEvent` passed to this handler is buffered and exported to the scores
|
|
|
154
152
|
async onFeedbackEvent(event: FeedbackEvent): Promise<void>
|
|
155
153
|
```
|
|
156
154
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `MastraPlatformExporter` is performed. All feedback events received here are forwarded unless the exporter is disabled.
|
|
155
|
+
Schedules feedback for export using the [feedback and score delivery](#feedback-and-score-delivery) behavior. Events are ignored when the exporter is disabled or shutdown has started. If Platform needs to look up the trace, a missing trace ID causes the record to be dropped.
|
|
160
156
|
|
|
161
|
-
**Returns:** `Promise<void>`
|
|
157
|
+
**Returns:** `Promise<void>` when the event has been scheduled or ignored. Call `flush()` to wait for pending deliveries, because this return value doesn't confirm delivery.
|
|
162
158
|
|
|
163
159
|
### flush
|
|
164
160
|
|
|
@@ -187,12 +183,18 @@ If no access token is provided via config or environment variable, the exporter:
|
|
|
187
183
|
|
|
188
184
|
### Batching
|
|
189
185
|
|
|
190
|
-
The exporter batches
|
|
186
|
+
The exporter batches traces, logs, and metrics, along with feedback and scores that already include their trace details:
|
|
191
187
|
|
|
192
188
|
- Flushes when total buffered event count reaches `maxBatchSize`
|
|
193
189
|
- Flushes when `maxBatchWaitMs` elapsed since the first buffered signal in the batch
|
|
194
190
|
- Flushes on `shutdown()`
|
|
195
191
|
|
|
192
|
+
### Feedback and score delivery
|
|
193
|
+
|
|
194
|
+
Feedback and scores received by the exporter can reference a trace stored in Platform using its trace ID and an optional span ID. If the record needs details from that trace, the exporter sends it immediately instead of waiting for a batch.
|
|
195
|
+
|
|
196
|
+
Call `flush()` before ending a short-lived process, or `shutdown()` when stopping the exporter, to wait for pending deliveries and retries. These methods finish when records have been accepted or dropped after a failure. Accepted feedback and scores may take time to appear in Platform.
|
|
197
|
+
|
|
196
198
|
### Byte batching
|
|
197
199
|
|
|
198
200
|
Set `byteBatching` to flush by serialized byte size and control concurrent uploads:
|
|
@@ -212,7 +214,7 @@ const exporter = new MastraPlatformExporter({
|
|
|
212
214
|
Without `byteBatching`, the exporter keeps its existing count-based batching behavior.
|
|
213
215
|
|
|
214
216
|
- `maxBatchBytes` triggers an upload when a batch reaches 8 MiB by default. Larger records are sent intact, without truncation or size-based drops.
|
|
215
|
-
- `maxConcurrentUploads` controls concurrent
|
|
217
|
+
- `maxConcurrentUploads` controls concurrent collector batch uploads. The default is two.
|
|
216
218
|
- `uploadTimeoutMs` sets the upload deadline, including retries. The default is 30 seconds.
|
|
217
219
|
|
|
218
220
|
Record-count and timer-based flush triggers still apply. Queued records are retained when uploads fall behind, so queue memory can grow.
|
|
@@ -221,7 +223,7 @@ Inspect the current queue with `exporter.getByteBatchingStats()`.
|
|
|
221
223
|
|
|
222
224
|
### Error handling
|
|
223
225
|
|
|
224
|
-
- Uses exponential backoff retry with `maxRetries` attempts
|
|
226
|
+
- Uses exponential backoff retry for collector batches with `maxRetries` attempts
|
|
225
227
|
- Drops batches after all retries fail
|
|
226
228
|
- Logs errors but continues processing new events
|
|
227
229
|
|
|
@@ -232,14 +234,14 @@ Errors raised by `MastraPlatformExporter` use the `MASTRA_PLATFORM_EXPORTER_*` `
|
|
|
232
234
|
When an organization has exhausted its observability quota, the Mastra platform rejects publish requests with `402 Payment Required` plus the `x-mastra-observability: disabled` header. When the exporter sees a `402` (or the header) on any publish route, it:
|
|
233
235
|
|
|
234
236
|
- Drops the rejected batch without retrying it
|
|
235
|
-
- Pauses
|
|
237
|
+
- Pauses collector batches for traces, logs, metrics, scores, and feedback, dropping buffered and incoming batch records
|
|
236
238
|
- Logs a warning that telemetry is paused
|
|
237
239
|
- Probes the platform periodically with an empty batch, using the interval from the `x-mastra-observability-retry-after` header (seconds), or every 5 minutes if the header is absent
|
|
238
240
|
- Resumes exporting automatically and logs a warning once the platform stops rejecting with `402`
|
|
239
241
|
|
|
240
242
|
The probe timer doesn't keep the Node.js process alive, so short-lived and serverless processes exit normally while paused.
|
|
241
243
|
|
|
242
|
-
Every request
|
|
244
|
+
Every collector request (batch uploads and the traces recovery probe) includes the `x-mastra-observability-capabilities: quota-pause-v1` header. This tells the platform that the client understands the quota-pause contract, so it can safely respond with `402` instead of silently dropping telemetry for older clients that would retry it.
|
|
243
245
|
|
|
244
246
|
### Endpoint routing
|
|
245
247
|
|
|
@@ -248,10 +250,11 @@ Every request the exporter sends (batch uploads for all five signal types, plus
|
|
|
248
250
|
- With `projectId` or `MASTRA_PROJECT_ID`, derived routes use `/projects/:projectId/ai/{signal}/publish`
|
|
249
251
|
- Explicit full publish URLs are used as-is, even when `projectId` is configured
|
|
250
252
|
|
|
251
|
-
###
|
|
253
|
+
### Event processing
|
|
252
254
|
|
|
253
255
|
- `exportTracingEvent()` only exports `SPAN_ENDED` tracing events
|
|
254
|
-
- `onLogEvent()
|
|
256
|
+
- `onLogEvent()` and `onMetricEvent()` buffer events
|
|
257
|
+
- `onScoreEvent()` and `onFeedbackEvent()` deliver records as described in [Feedback and score delivery](#feedback-and-score-delivery)
|
|
255
258
|
- All supported signal batches are uploaded to their matching publish endpoints during `flush()` and `shutdown()`
|
|
256
259
|
|
|
257
260
|
## Span wire format
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
|
|
1
|
+
import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEvent, FeedbackEvent, FeedbackReplacementEvent } from '@mastra/core/observability';
|
|
2
2
|
import type { TracingStorageStrategy } from '@mastra/core/storage';
|
|
3
3
|
import type { BaseExporterConfig } from './base.js';
|
|
4
4
|
import { BaseExporter } from './base.js';
|
|
@@ -93,14 +93,11 @@ export declare class DefaultExporter extends BaseExporter {
|
|
|
93
93
|
* Handle log events — buffer for batch flush.
|
|
94
94
|
*/
|
|
95
95
|
onLogEvent(event: LogEvent): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Handle score events — buffer for batch flush.
|
|
98
|
-
*/
|
|
99
96
|
onScoreEvent(event: ScoreEvent): Promise<void>;
|
|
100
|
-
|
|
101
|
-
* Handle feedback events — buffer for batch flush.
|
|
102
|
-
*/
|
|
97
|
+
onFeedbackReplacementEvent(event: FeedbackReplacementEvent): Promise<void>;
|
|
103
98
|
onFeedbackEvent(event: FeedbackEvent): Promise<void>;
|
|
99
|
+
private enqueueAnnotation;
|
|
100
|
+
private storeAnnotation;
|
|
104
101
|
/**
|
|
105
102
|
* Force flush any buffered spans without shutting down the exporter.
|
|
106
103
|
* This is useful in serverless environments where you need to ensure spans
|
|
@@ -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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GG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;;;;;;OAOG;YACW,WAAW;IAkInB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5D;IAED;;;;OAIG;YACW,WAAW;IAOzB;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrD;IAED;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/C;IAED,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7C;IAED,0BAA0B,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE;IAED,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnD;IAED,OAAO,CAAC,iBAAiB;YAUX,eAAe;IAgC7B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA4B3B;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB9B;CACF"}
|
|
@@ -12,7 +12,10 @@ export interface UpdateSpanPartial {
|
|
|
12
12
|
updates: Partial<UpdateSpanRecord>;
|
|
13
13
|
}
|
|
14
14
|
/** An observability event augmented with retry tracking for the buffer. */
|
|
15
|
-
export type
|
|
15
|
+
export type BufferableEvent = Exclude<ObservabilityEvent, {
|
|
16
|
+
type: 'feedback_replacement';
|
|
17
|
+
}>;
|
|
18
|
+
export type BufferedEvent = BufferableEvent & RetryCount;
|
|
16
19
|
/**
|
|
17
20
|
* Buffers observability events (creates and updates) for batch flushing.
|
|
18
21
|
* Handles strategy-aware routing of tracing events and tracks created spans
|
|
@@ -34,7 +37,7 @@ export declare class EventBuffer {
|
|
|
34
37
|
private pushCreate;
|
|
35
38
|
private pushUpdate;
|
|
36
39
|
/** Route an event to the create or update buffer based on its type and the storage strategy. */
|
|
37
|
-
addEvent(event:
|
|
40
|
+
addEvent(event: BufferableEvent): void;
|
|
38
41
|
/** Re-add failed create events to the buffer, returning events that exceed max retries. */
|
|
39
42
|
reAddCreates(events: BufferedEvent[]): BufferedEvent[];
|
|
40
43
|
/** Re-add failed update events to the buffer, returning events that exceed max retries. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-buffer.d.ts","sourceRoot":"","sources":["../../src/exporters/event-buffer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpC;AAED,2EAA2E;AAC3E,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"event-buffer.d.ts","sourceRoot":"","sources":["../../src/exporters/event-buffer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM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CAEtB;IAED,4EAA4E;IAC5E,IAAI,OAAO,IAAI,MAAM,CAKpB;IAED;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,eAAe;IAIvB,6FAA6F;IAC7F,eAAe,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,gBAAgB,EAAE,CAAA;KAAE,GAAG,IAAI,CAc3D;IAED,6FAA6F;IAC7F,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAMlD;IAED,gFAAgF;IAChF,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAEzC;IAED,sGAAsG;IACtG,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAE/C;IAED,uFAAuF;IACvF,gBAAgB,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,iBAAiB,EAAE,CAAA;KAAE,GAAG,IAAI,CAU7D;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TracingEvent, LogEvent, MetricEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
|
|
1
|
+
import type { TracingEvent, LogEvent, MetricEvent, ScoreEvent, FeedbackEvent, FeedbackReplacementEvent } from '@mastra/core/observability';
|
|
2
2
|
import { BaseExporter } from './base.js';
|
|
3
3
|
import type { BaseExporterConfig } from './base.js';
|
|
4
4
|
import type { PlatformByteBatchingConfig, PlatformByteBatchingStats } from './platform-byte-batcher.js';
|
|
@@ -37,6 +37,7 @@ export declare class MastraPlatformExporter extends BaseExporter {
|
|
|
37
37
|
private buffer;
|
|
38
38
|
private flushTimer;
|
|
39
39
|
private inFlightFlushes;
|
|
40
|
+
private pendingRecords;
|
|
40
41
|
private quotaPaused;
|
|
41
42
|
private quotaProbeTimer;
|
|
42
43
|
private quotaProbeIntervalSeconds;
|
|
@@ -49,6 +50,8 @@ export declare class MastraPlatformExporter extends BaseExporter {
|
|
|
49
50
|
onMetricEvent(event: MetricEvent): Promise<void>;
|
|
50
51
|
onScoreEvent(event: ScoreEvent): Promise<void>;
|
|
51
52
|
onFeedbackEvent(event: FeedbackEvent): Promise<void>;
|
|
53
|
+
onFeedbackReplacementEvent(event: FeedbackReplacementEvent): void;
|
|
54
|
+
private enqueueResolvedRecord;
|
|
52
55
|
private addToBuffer;
|
|
53
56
|
private addLogToBuffer;
|
|
54
57
|
private addMetricToBuffer;
|
|
@@ -97,6 +100,7 @@ export declare class MastraPlatformExporter extends BaseExporter {
|
|
|
97
100
|
* are exported before the runtime instance is terminated.
|
|
98
101
|
*/
|
|
99
102
|
flush(): Promise<void>;
|
|
103
|
+
private flushBatches;
|
|
100
104
|
shutdown(): Promise<void>;
|
|
101
105
|
}
|
|
102
106
|
//# sourceMappingURL=mastra-platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mastra-platform.d.ts","sourceRoot":"","sources":["../../src/exporters/mastra-platform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,
|
|
1
|
+
{"version":3,"file":"mastra-platform.d.ts","sourceRoot":"","sources":["../../src/exporters/mastra-platform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACb,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGrG,YAAY,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAErG,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,U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W,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrD;IAEK,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnD;IAEK,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzD;IAED,0BAA0B,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAOhE;IAED,OAAO,CAAC,qBAAqB;IAwC7B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;YAMR,mBAAmB;IAajC,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,aAAa;YAoBP,WAAW;IA4EzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,gBAAgB;YAIV,WAAW;YAIX,UAAU;IAuDxB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,kBAAkB;IAkB1B;;;;;OAKG;YACW,gBAAgB;IAoD9B,gFAAgF;IAChF,oBAAoB,IAAI,yBAAyB,GAAG,SAAS,CAE5D;YAEa,cAAc;YAuBd,gBAAgB;IAmC9B,OAAO,CAAC,WAAW;IAUnB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAW3B;YAEa,YAAY;IAgCpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAqC9B;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
|
|
1
|
+
import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEvent, FeedbackEvent, FeedbackReplacementEvent } from '@mastra/core/observability';
|
|
2
2
|
import type { TracingStorageStrategy } from '@mastra/core/storage';
|
|
3
3
|
import type { BaseExporterConfig } from './base.js';
|
|
4
4
|
import { BaseExporter } from './base.js';
|
|
@@ -96,14 +96,11 @@ export declare class MastraStorageExporter extends BaseExporter {
|
|
|
96
96
|
* Handle log events — buffer for batch flush.
|
|
97
97
|
*/
|
|
98
98
|
onLogEvent(event: LogEvent): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Handle score events — buffer for batch flush.
|
|
101
|
-
*/
|
|
102
99
|
onScoreEvent(event: ScoreEvent): Promise<void>;
|
|
103
|
-
|
|
104
|
-
* Handle feedback events — buffer for batch flush.
|
|
105
|
-
*/
|
|
100
|
+
onFeedbackReplacementEvent(event: FeedbackReplacementEvent): Promise<void>;
|
|
106
101
|
onFeedbackEvent(event: FeedbackEvent): Promise<void>;
|
|
102
|
+
private enqueueAnnotation;
|
|
103
|
+
private storeAnnotation;
|
|
107
104
|
/**
|
|
108
105
|
* Force flush any buffered spans without shutting down the exporter.
|
|
109
106
|
* This is useful in serverless environments where you need to ensure spans
|
|
@@ -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,EACb,wBAAwB,EAIzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAwB,sBAAsB,EAAwB,MAAM,sBAAsB,CAAC;AAS/G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;;;;;;;OAOG;YACW,WAAW;IAuJzB,oBAAoB,IAAI,wBAAwB,GAAG,SAAS,CAE3D;IAEK,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5D;IAED;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrD;IAED;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/C;IAED,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7C;IAED,0BAA0B,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE;IAED,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnD;IAED,OAAO,CAAC,iBAAiB;YAUX,eAAe;IAgC7B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA2C3B;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA6B9B;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Deliver one feedback or score record whose span context must be resolved by Platform. */
|
|
2
|
+
export declare function publishResolvedRecord(url: URL, body: string, headers: Record<string, string>, method?: 'POST' | 'PUT'): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=platform-resolved-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-resolved-record.d.ts","sourceRoot":"","sources":["../../src/exporters/platform-resolved-record.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,MAAM,GAAE,MAAM,GAAG,KAAc,GAC9B,OAAO,CAAC,IAAI,CAAC,CA2Cf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FeedbackEvent, FeedbackReplacementEvent, ScoreEvent } from '@mastra/core/observability';
|
|
2
|
+
import type { ObservabilityStorage } from '@mastra/core/storage';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve attached-storage context within a bounded retry window, including failed reads.
|
|
5
|
+
* Exhaustion returns null for missing anchors or throws the last read error for the exporter to report.
|
|
6
|
+
* Other destinations receive the original event independently.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveStorageAnnotation(event: ScoreEvent | FeedbackEvent | FeedbackReplacementEvent, storage: ObservabilityStorage, flushSpans: () => Promise<void>): Promise<ScoreEvent | FeedbackEvent | FeedbackReplacementEvent | null>;
|
|
9
|
+
//# sourceMappingURL=storage-annotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-annotation.d.ts","sourceRoot":"","sources":["../../src/exporters/storage-annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAMjE;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,UAAU,GAAG,aAAa,GAAG,wBAAwB,EAC5D,OAAO,EAAE,oBAAoB,EAC7B,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC9B,OAAO,CAAC,UAAU,GAAG,aAAa,GAAG,wBAAwB,GAAG,IAAI,CAAC,CAuBvE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { BufferedEvent } from './event-buffer.js';
|
|
1
|
+
import type { BufferableEvent, BufferedEvent } from './event-buffer.js';
|
|
3
2
|
export interface StorageByteBatchingConfig {
|
|
4
3
|
/** Serialized buffered-event byte threshold for flushing. Default: 8 MiB. Adapter encoding can add overhead. */
|
|
5
4
|
maxBatchBytes?: number;
|
|
@@ -21,7 +20,7 @@ export declare class StorageByteTracker {
|
|
|
21
20
|
private pendingRecords;
|
|
22
21
|
queuedBytes: number;
|
|
23
22
|
constructor(config: Required<StorageByteBatchingConfig>);
|
|
24
|
-
capture(event:
|
|
23
|
+
capture(event: BufferableEvent): BufferedEvent;
|
|
25
24
|
size(event: BufferedEvent): number;
|
|
26
25
|
enqueue(event: BufferedEvent): void;
|
|
27
26
|
dequeue(event: BufferedEvent): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-byte-tracker.d.ts","sourceRoot":"","sources":["../../src/exporters/storage-byte-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"storage-byte-tracker.d.ts","sourceRoot":"","sources":["../../src/exporters/storage-byte-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC,gHAAgH;IAChH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,yBAAyB,GAAG,QAAQ,CAAC,yBAAyB,CAAC,CAUjH;AAED,mGAAmG;AACnG,qBAAa,kBAAkB;IAOjB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,yBAAyB,CAAC;IANhE,OAAO,CAAC,KAAK,CAAwC;IACrD,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,cAAc,CAAK;IAC3B,WAAW,SAAK;IAEhB,YAAqB,MAAM,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EAAI;IAEpE,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CAU7C;IAED,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAEjC;IAED,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAKlC;IAED,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAElC;IAED,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAQ/C;IAED,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,wBAAwB,CAMpD;CACF"}
|