@mastra/observability 1.23.2-alpha.1 → 1.24.0-alpha.3

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.
Files changed (34) hide show
  1. package/dist/config.d.ts +13 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/docs/SKILL.md +1 -1
  4. package/dist/docs/assets/SOURCE_MAP.json +42 -42
  5. package/dist/docs/references/docs-observability-integrations-exporters-mastra-storage.md +41 -0
  6. package/dist/docs/references/integrations-observability-arize.md +1 -1
  7. package/dist/docs/references/reference-observability-tracing-configuration.md +3 -0
  8. package/dist/docs/references/reference-observability-tracing-exporters-mastra-platform-exporter.md +33 -0
  9. package/dist/docs/references/reference-observability-tracing-exporters-mastra-storage-exporter.md +30 -0
  10. package/dist/exporters/event-buffer.d.ts +9 -0
  11. package/dist/exporters/event-buffer.d.ts.map +1 -1
  12. package/dist/exporters/mastra-platform.d.ts +10 -0
  13. package/dist/exporters/mastra-platform.d.ts.map +1 -1
  14. package/dist/exporters/mastra-storage.d.ts +4 -0
  15. package/dist/exporters/mastra-storage.d.ts.map +1 -1
  16. package/dist/exporters/platform-byte-batcher.d.ts +42 -0
  17. package/dist/exporters/platform-byte-batcher.d.ts.map +1 -0
  18. package/dist/exporters/storage-byte-tracker.d.ts +31 -0
  19. package/dist/exporters/storage-byte-tracker.d.ts.map +1 -0
  20. package/dist/exporters/storage-platform-policy.d.ts +8 -0
  21. package/dist/exporters/storage-platform-policy.d.ts.map +1 -0
  22. package/dist/index.cjs +622 -110
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +622 -110
  25. package/dist/index.js.map +1 -1
  26. package/dist/instances/base.d.ts +1 -0
  27. package/dist/instances/base.d.ts.map +1 -1
  28. package/dist/instances/platform-policy.d.ts +2 -0
  29. package/dist/instances/platform-policy.d.ts.map +1 -1
  30. package/dist/metrics/pricing-data.json +916 -618
  31. package/dist/model-tracing.d.ts.map +1 -1
  32. package/dist/spans/default.d.ts +8 -0
  33. package/dist/spans/default.d.ts.map +1 -1
  34. package/package.json +3 -3
package/dist/config.d.ts CHANGED
@@ -51,6 +51,17 @@ export interface ObservabilityInstanceConfig {
51
51
  sampling?: SamplingStrategy;
52
52
  /** Custom exporters */
53
53
  exporters?: ObservabilityExporter[];
54
+ /**
55
+ * Keep configured MastraStorageExporter instances on Mastra Platform deployments.
56
+ * Defaults to false: when MASTRA_DEPLOYMENT_ID is set, MastraStorageExporter
57
+ * and the deprecated DefaultExporter are skipped. Set to true to persist to
58
+ * your own storage alongside Platform observability. Applies to this instance,
59
+ * including exporters registered later; does not add an exporter automatically.
60
+ * Storage domains reporting local persistence remain disabled on Platform,
61
+ * with a warning during exporter initialization, even when this is true.
62
+ * The deprecated DefaultExporter remains disabled on Platform.
63
+ */
64
+ retainStorageExporterOnPlatform?: boolean;
54
65
  /** Observability bridge (e.g., OpenTelemetry bridge for context extraction) */
55
66
  bridge?: ObservabilityBridge;
56
67
  /** Custom span output processors */
@@ -193,6 +204,7 @@ export declare const observabilityInstanceConfigSchema: z.ZodObject<{
193
204
  sampler: z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>;
194
205
  }, z.core.$strip>], "type">>;
195
206
  exporters: z.ZodOptional<z.ZodArray<z.ZodAny>>;
207
+ retainStorageExporterOnPlatform: z.ZodOptional<z.ZodBoolean>;
196
208
  bridge: z.ZodOptional<z.ZodAny>;
197
209
  spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny>>;
198
210
  includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
@@ -239,6 +251,7 @@ export declare const observabilityConfigValueSchema: z.ZodObject<{
239
251
  sampler: z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>;
240
252
  }, z.core.$strip>], "type">>;
241
253
  exporters: z.ZodOptional<z.ZodArray<z.ZodAny>>;
254
+ retainStorageExporterOnPlatform: z.ZodOptional<z.ZodBoolean>;
242
255
  bridge: z.ZodOptional<z.ZodAny>;
243
256
  spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny>>;
244
257
  includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAMpE;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAMD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAA;CAAE,CAAC;AAMhG;;GAEG;AACH,MAAM,WAAW,2BA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;IACH,OAAO,CAAC,EAAE;QACR,iGAAiG;QACjG,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,iFAAiF;QACjF,KAAK,CAAC,EAAE,QAAQ,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,2BAA2B,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC,CAAC;IAC5F,yEAAyE;IACzE,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAAmB,CAAC,EAAE,OAAO,GAAG,0BAA0B,CAAC;CAC5D;AAMD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;mCA7JO,GAAG,EAAE,KAAK,OAAO;2BA4KzD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;kBAO1B,CAAC;AAoCd;;;;GAIG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;uCAjOJ,GAAG,EAAE,KAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgPxD,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;uCAtPD,GAAG,EAAE,KAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgQ1D,CAAC;AAgBF,eAAO,MAAM,iCAAiC;;;;;wDAhRJ,GAAG,EAAE,KAAK,OAAO;;;;;;;;;;iBAsVxD,CAAC"}
@@ -3,7 +3,7 @@ name: mastra-observability
3
3
  description: Documentation for @mastra/observability. Use when working with @mastra/observability APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/observability"
6
- version: "1.23.2-alpha.1"
6
+ version: "1.24.0-alpha.3"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "1.23.2-alpha.1",
2
+ "version": "1.24.0-alpha.3",
3
3
  "package": "@mastra/observability",
4
4
  "exports": {
5
5
  "BaseExporter": {
6
6
  "types": "dist/exporters/base.d.ts",
7
7
  "implementation": "dist/index.js",
8
- "line": 4147
8
+ "line": 4238
9
9
  },
10
10
  "BaseObservabilityEventBus": {
11
11
  "types": "dist/bus/base.d.ts",
@@ -15,27 +15,27 @@
15
15
  "BaseObservabilityInstance": {
16
16
  "types": "dist/instances/base.d.ts",
17
17
  "implementation": "dist/index.js",
18
- "line": 5399
18
+ "line": 5714
19
19
  },
20
20
  "BaseSpan": {
21
21
  "types": "dist/spans/base.d.ts",
22
22
  "implementation": "dist/index.js",
23
- "line": 3433
23
+ "line": 3523
24
24
  },
25
25
  "CardinalityFilter": {
26
26
  "types": "dist/metrics/cardinality.d.ts",
27
27
  "implementation": "dist/index.js",
28
- "line": 2075
28
+ "line": 2076
29
29
  },
30
30
  "CloudExporter": {
31
31
  "types": "dist/exporters/cloud.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 7804
33
+ "line": 8133
34
34
  },
35
35
  "ConsoleExporter": {
36
36
  "types": "dist/exporters/console.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 8127
38
+ "line": 8456
39
39
  },
40
40
  "DEFAULT_DEEP_CLEAN_OPTIONS": {
41
41
  "types": "dist/spans/serialization.d.ts",
@@ -45,67 +45,67 @@
45
45
  "DEFAULT_LIMITS": {
46
46
  "types": "dist/client/proxy.d.ts",
47
47
  "implementation": "dist/index.js",
48
- "line": 6370
48
+ "line": 6699
49
49
  },
50
50
  "DefaultExporter": {
51
51
  "types": "dist/exporters/default.d.ts",
52
52
  "implementation": "dist/index.js",
53
- "line": 4472
53
+ "line": 4620
54
54
  },
55
55
  "DefaultObservabilityInstance": {
56
56
  "types": "dist/instances/default.d.ts",
57
57
  "implementation": "dist/index.js",
58
- "line": 9771
58
+ "line": 10283
59
59
  },
60
60
  "DefaultSpan": {
61
61
  "types": "dist/spans/default.d.ts",
62
62
  "implementation": "dist/index.js",
63
- "line": 3919
63
+ "line": 4009
64
64
  },
65
65
  "JsonExporter": {
66
66
  "types": "dist/exporters/test.d.ts",
67
67
  "implementation": "dist/index.js",
68
- "line": 9769
68
+ "line": 10281
69
69
  },
70
70
  "LoggerContextImpl": {
71
71
  "types": "dist/context/logger.d.ts",
72
72
  "implementation": "dist/index.js",
73
- "line": 937
73
+ "line": 938
74
74
  },
75
75
  "MastraPlatformExporter": {
76
76
  "types": "dist/exporters/mastra-platform.d.ts",
77
77
  "implementation": "dist/index.js",
78
- "line": 8301
78
+ "line": 8751
79
79
  },
80
80
  "MastraStorageExporter": {
81
81
  "types": "dist/exporters/mastra-storage.d.ts",
82
82
  "implementation": "dist/index.js",
83
- "line": 4920
83
+ "line": 5139
84
84
  },
85
85
  "MetricsContextImpl": {
86
86
  "types": "dist/context/metrics.d.ts",
87
87
  "implementation": "dist/index.js",
88
- "line": 1001
88
+ "line": 1002
89
89
  },
90
90
  "ModelSpanTracker": {
91
91
  "types": "dist/model-tracing.d.ts",
92
92
  "implementation": "dist/index.js",
93
- "line": 2507
93
+ "line": 2508
94
94
  },
95
95
  "NoOpSpan": {
96
96
  "types": "dist/spans/no-op.d.ts",
97
97
  "implementation": "dist/index.js",
98
- "line": 4090
98
+ "line": 4181
99
99
  },
100
100
  "OBSERVABILITY_CAPABILITIES_HEADER": {
101
101
  "types": "dist/exporters/mastra-platform.d.ts",
102
102
  "implementation": "dist/index.js",
103
- "line": 8202
103
+ "line": 8652
104
104
  },
105
105
  "Observability": {
106
106
  "types": "dist/default.d.ts",
107
107
  "implementation": "dist/index.js",
108
- "line": 10428
108
+ "line": 10940
109
109
  },
110
110
  "ObservabilityBus": {
111
111
  "types": "dist/bus/observability-bus.d.ts",
@@ -115,7 +115,7 @@
115
115
  "QUOTA_PAUSE_CAPABILITY": {
116
116
  "types": "dist/exporters/mastra-platform.d.ts",
117
117
  "implementation": "dist/index.js",
118
- "line": 8203
118
+ "line": 8653
119
119
  },
120
120
  "SamplingStrategyType": {
121
121
  "types": "dist/config.d.ts",
@@ -125,57 +125,57 @@
125
125
  "SensitiveDataFilter": {
126
126
  "types": "dist/span_processors/sensitive-data-filter.d.ts",
127
127
  "implementation": "dist/index.js",
128
- "line": 10198
128
+ "line": 10710
129
129
  },
130
130
  "TestExporter": {
131
131
  "types": "dist/exporters/test.d.ts",
132
132
  "implementation": "dist/index.js",
133
- "line": 8784
133
+ "line": 9296
134
134
  },
135
135
  "TraceData": {
136
136
  "types": "dist/exporters/tracking.d.ts",
137
137
  "implementation": "dist/index.js",
138
- "line": 6523
138
+ "line": 6852
139
139
  },
140
140
  "TrackingExporter": {
141
141
  "types": "dist/exporters/tracking.d.ts",
142
142
  "implementation": "dist/index.js",
143
- "line": 6852
143
+ "line": 7181
144
144
  },
145
145
  "buildExportedLog": {
146
146
  "types": "dist/client/otlp.d.ts",
147
147
  "implementation": "dist/index.js",
148
- "line": 6287
148
+ "line": 6616
149
149
  },
150
150
  "buildExportedSpan": {
151
151
  "types": "dist/client/otlp.d.ts",
152
152
  "implementation": "dist/index.js",
153
- "line": 6269
153
+ "line": 6598
154
154
  },
155
155
  "buildTracingOptions": {
156
156
  "types": "dist/tracing-options.d.ts",
157
157
  "implementation": "dist/index.js",
158
- "line": 10773
158
+ "line": 11285
159
159
  },
160
160
  "chainFormatters": {
161
161
  "types": "dist/exporters/span-formatters.d.ts",
162
162
  "implementation": "dist/index.js",
163
- "line": 7618
163
+ "line": 7947
164
164
  },
165
165
  "createClientObservabilityProxy": {
166
166
  "types": "dist/client/proxy.d.ts",
167
167
  "implementation": "dist/index.js",
168
- "line": 6504
168
+ "line": 6833
169
169
  },
170
170
  "decodeResourceLogs": {
171
171
  "types": "dist/client/otlp.d.ts",
172
172
  "implementation": "dist/index.js",
173
- "line": 6206
173
+ "line": 6535
174
174
  },
175
175
  "decodeResourceSpans": {
176
176
  "types": "dist/client/otlp.d.ts",
177
177
  "implementation": "dist/index.js",
178
- "line": 6169
178
+ "line": 6498
179
179
  },
180
180
  "deepClean": {
181
181
  "types": "dist/spans/serialization.d.ts",
@@ -185,17 +185,17 @@
185
185
  "formatBaggage": {
186
186
  "types": "dist/client/w3c.d.ts",
187
187
  "implementation": "dist/index.js",
188
- "line": 6360
188
+ "line": 6689
189
189
  },
190
190
  "formatTraceparent": {
191
191
  "types": "dist/client/w3c.d.ts",
192
192
  "implementation": "dist/index.js",
193
- "line": 6323
193
+ "line": 6652
194
194
  },
195
195
  "getExternalParentId": {
196
196
  "types": "dist/spans/base.d.ts",
197
197
  "implementation": "dist/index.js",
198
- "line": 3414
198
+ "line": 3504
199
199
  },
200
200
  "isSerializedMap": {
201
201
  "types": "dist/spans/serialization.d.ts",
@@ -210,37 +210,37 @@
210
210
  "observabilityConfigValueSchema": {
211
211
  "types": "dist/config.d.ts",
212
212
  "implementation": "dist/index.js",
213
- "line": 816
213
+ "line": 817
214
214
  },
215
215
  "observabilityFeatures": {
216
216
  "types": "dist/features.d.ts",
217
217
  "implementation": "dist/index.js",
218
- "line": 10754
218
+ "line": 11266
219
219
  },
220
220
  "observabilityInstanceConfigSchema": {
221
221
  "types": "dist/config.d.ts",
222
222
  "implementation": "dist/index.js",
223
- "line": 804
223
+ "line": 805
224
224
  },
225
225
  "observabilityRegistryConfigSchema": {
226
226
  "types": "dist/config.d.ts",
227
227
  "implementation": "dist/index.js",
228
- "line": 836
228
+ "line": 837
229
229
  },
230
230
  "otlpSeverityToLogLevel": {
231
231
  "types": "dist/client/otlp.d.ts",
232
232
  "implementation": "dist/index.js",
233
- "line": 6243
233
+ "line": 6572
234
234
  },
235
235
  "parseBaggage": {
236
236
  "types": "dist/client/w3c.d.ts",
237
237
  "implementation": "dist/index.js",
238
- "line": 6333
238
+ "line": 6662
239
239
  },
240
240
  "parseTraceparent": {
241
241
  "types": "dist/client/w3c.d.ts",
242
242
  "implementation": "dist/index.js",
243
- "line": 6309
243
+ "line": 6638
244
244
  },
245
245
  "reconstructSerializedMap": {
246
246
  "types": "dist/spans/serialization.d.ts",
@@ -74,6 +74,47 @@ export const mastra = new Mastra({
74
74
  })
75
75
  ```
76
76
 
77
+ ## Export to storage and Platform
78
+
79
+ On Mastra Platform, a nonempty `MASTRA_DEPLOYMENT_ID` disables `MastraStorageExporter` and the deprecated `DefaultExporter` by default. Other exporters remain enabled. The opt-in below applies only to `MastraStorageExporter`. Deprecated `DefaultExporter` stays disabled on Platform even with the flag set to `true`. Migrate to `MastraStorageExporter` to use this option.
80
+
81
+ > **Local storage remains blocked even with the opt-in:** `retainStorageExporterOnPlatform: true` **doesn't** enable in-memory, local libSQL, or DuckDB observability writes on Platform. When the observability domain reports local persistence, the built-in storage exporter stays disabled: it won't persist traces, logs, metrics, scores, or feedback to that database. Other exporters continue to receive events.
82
+
83
+ With updated adapters and `retainStorageExporterOnPlatform: true`, the behavior on Platform is:
84
+
85
+ | Observability database | Storage export on Platform |
86
+ | --------------------------------------------------------------------- | -------------------------------- |
87
+ | PostgreSQL | Allowed |
88
+ | Remote libSQL/Turso (`libsql://` or `https://`) | Allowed |
89
+ | Local libSQL (`file:` or `:memory:`) | Blocked |
90
+ | libSQL embedded replica with a remote sync URL | Blocked: it still writes locally |
91
+ | DuckDB, including in-memory databases | Blocked |
92
+ | `InMemoryStore`, including the fallback when no storage is configured | Blocked |
93
+
94
+ To keep writing to your own remote database alongside Platform observability, set [`retainStorageExporterOnPlatform`](https://mastra.ai/reference/observability/tracing/configuration) to `true` on the observability config:
95
+
96
+ ```typescript
97
+ import { Observability, MastraStorageExporter, MastraPlatformExporter } from '@mastra/observability'
98
+
99
+ const observability = new Observability({
100
+ configs: {
101
+ production: {
102
+ serviceName: 'my-service',
103
+ retainStorageExporterOnPlatform: true,
104
+ exporters: [new MastraStorageExporter(), new MastraPlatformExporter()],
105
+ },
106
+ },
107
+ })
108
+ ```
109
+
110
+ Pass this `observability` instance to `new Mastra()` alongside your configured `storage` provider. The option applies only to this config, including exporters registered later. It doesn't configure a database or add exporters automatically. Other configs keep the default suppression unless they also opt in.
111
+
112
+ The restriction applies to the **observability domain**, which can use a different provider from your default application storage. It doesn't disable other storage domains. Outside Platform, local observability storage continues to work.
113
+
114
+ To enable this guard, upgrade `@mastra/core` and any `@mastra/libsql` or `@mastra/duckdb` adapters alongside `@mastra/observability`: older or custom adapters without the `persistenceLocation` capability retain the existing opt-in behavior and aren't checked for local persistence.
115
+
116
+ A blocked exporter logs a warning during initialization, but the restriction applies even if your logging setup hides that warning. If dual export isn't writing to your database, check the observability provider against the table above and configure a remote database. Retrying or increasing the batch interval won't enable a blocked exporter.
117
+
77
118
  ## Studio
78
119
 
79
120
  Access your traces through Studio:
@@ -6,7 +6,7 @@
6
6
 
7
7
  [Arize AI](https://arize.com/?utm_source=mastra-docs\&utm_medium=partner\&utm_campaign=partner-docs\&utm_content=observability-arize) provides observability and evaluation for AI applications through [Arize Phoenix](https://arize.com/phoenix/) and [Arize AX](https://arize.com/products/ax/). Use Phoenix for a local or self-hosted open-source workflow, and use Arize AX for managed cloud or enterprise self-hosted production observability. The Arize exporter sends traces using OpenTelemetry and [OpenInference](https://github.com/Arize-ai/openinference/tree/main/spec) semantic conventions, compatible with any OpenTelemetry platform that supports OpenInference.
8
8
 
9
- For workflows that use traces to improve quality, see Arize's [agent evaluation guide](https://arize.com/guides/ai-agent-handbook/agent-evaluation/) and [LLM evaluation guide](https://arize.com/resources/llm-evaluation/).
9
+ For workflows that use traces to improve quality, see Arize's [agent evaluation guide](https://arize.com/ai-agents/agent-evaluation/) and [LLM evaluation guide](https://arize.com/resources/llm-evaluation/).
10
10
 
11
11
  ## Installation
12
12
 
@@ -31,6 +31,7 @@ interface ObservabilityInstanceConfig {
31
31
  serviceName: string
32
32
  sampling?: SamplingStrategy
33
33
  exporters?: ObservabilityExporter[]
34
+ retainStorageExporterOnPlatform?: boolean
34
35
  spanOutputProcessors?: SpanOutputProcessor[]
35
36
  includeInternalSpans?: boolean
36
37
  excludeSpanTypes?: SpanType[]
@@ -49,6 +50,8 @@ interface ObservabilityInstanceConfig {
49
50
 
50
51
  **exporters** (`ObservabilityExporter[]`): Trace data exporters
51
52
 
53
+ **retainStorageExporterOnPlatform** (`boolean`): Defaults to false. Retains configured MastraStorageExporter instances on Platform, including later registration. Known local storage remains blocked, and deprecated DefaultExporter remains disabled. See storage export on Platform for configuration, adapter requirements, and restrictions.
54
+
52
55
  **spanOutputProcessors** (`SpanOutputProcessor[]`): Span output processors
53
56
 
54
57
  **includeInternalSpans** (`boolean`): Include spans internal to Mastra operations
@@ -30,6 +30,13 @@ interface MastraPlatformExporterConfig extends BaseExporterConfig {
30
30
  /** Maximum wait time before flushing in milliseconds. Default: 5000 */
31
31
  maxBatchWaitMs?: number
32
32
 
33
+ /** Opt into byte-triggered batches and upload concurrency control */
34
+ byteBatching?: {
35
+ maxBatchBytes?: number // Default: 8 MiB
36
+ maxConcurrentUploads?: number // Default: 2
37
+ uploadTimeoutMs?: number // Default: 30000
38
+ }
39
+
33
40
  /** Maximum retry attempts. Default: 3 */
34
41
  maxRetries?: number
35
42
 
@@ -186,6 +193,32 @@ The exporter batches tracing spans, logs, metrics, scores, and feedback for effi
186
193
  - Flushes when `maxBatchWaitMs` elapsed since the first buffered signal in the batch
187
194
  - Flushes on `shutdown()`
188
195
 
196
+ ### Byte batching
197
+
198
+ Set `byteBatching` to flush by serialized byte size and control concurrent uploads:
199
+
200
+ ```typescript
201
+ import { MastraPlatformExporter } from '@mastra/observability'
202
+
203
+ const exporter = new MastraPlatformExporter({
204
+ byteBatching: {
205
+ maxBatchBytes: 8 * 1024 * 1024,
206
+ maxConcurrentUploads: 2,
207
+ uploadTimeoutMs: 30_000,
208
+ },
209
+ })
210
+ ```
211
+
212
+ Without `byteBatching`, the exporter keeps its existing count-based batching behavior.
213
+
214
+ - `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 uploads across all signal types. The default is two.
216
+ - `uploadTimeoutMs` sets the upload deadline, including retries. The default is 30 seconds.
217
+
218
+ Record-count and timer-based flush triggers still apply. Queued records are retained when uploads fall behind, so queue memory can grow.
219
+
220
+ Inspect the current queue with `exporter.getByteBatchingStats()`.
221
+
189
222
  ### Error handling
190
223
 
191
224
  - Uses exponential backoff retry with `maxRetries` attempts
@@ -8,6 +8,10 @@ Persists traces to Mastra's configured storage with automatic batching and retry
8
8
 
9
9
  > **Note:** `MastraStorageExporter` was previously called `DefaultExporter`. The original `DefaultExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it's deprecated and will be removed in a future major version. New code should use `MastraStorageExporter`.
10
10
 
11
+ > **Platform storage restrictions:** When `MASTRA_DEPLOYMENT_ID` is set, this exporter is disabled by default. Set `retainStorageExporterOnPlatform: true` on the **observability config**, not the exporter constructor, to allow remote storage export. `InMemoryStore` (including the fallback when no storage is configured), local libSQL, embedded replicas, and DuckDB remain blocked when the adapter reports local persistence, even with the opt-in. No observability events are written to that local database, even if the initialization warning is hidden by your logging setup.
12
+ >
13
+ > See [storage export on Platform](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage) for the supported-provider table, adapter upgrade requirements, and a configuration example.
14
+
11
15
  ## Span previews
12
16
 
13
17
  `MastraStorageExporter` automatically generates short, readable `inputPreview`, `outputPreview`, and `errorPreview` summaries based on the span type. Each preview contains up to 100 characters plus an ellipsis when truncated. Full payloads remain available separately.
@@ -22,6 +26,12 @@ new MastraStorageExporter(config?: MastraStorageExporterConfig)
22
26
 
23
27
  ```typescript
24
28
  interface MastraStorageExporterConfig extends BaseExporterConfig {
29
+ /** Opt-in byte flush thresholds. Omit to keep count-based batching. */
30
+ byteBatching?: {
31
+ maxBatchBytes?: number // Default: 8 MiB
32
+ maxConcurrentWrites?: number // Default: 1
33
+ }
34
+
25
35
  /** Maximum number of spans per batch. Default: 1000 */
26
36
  maxBatchSize?: number
27
37
 
@@ -47,6 +57,26 @@ Extends `BaseExporterConfig`, which includes:
47
57
  - `logger?: IMastraLogger` - Logger instance
48
58
  - `logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error'` - Log level (default: INFO)
49
59
 
60
+ ## Byte batching
61
+
62
+ Enable byte batching with `byteBatching: {}` or supply custom thresholds. The exporter ignores byte batching when the resolved strategy is `realtime`, which keeps its immediate, awaited writes:
63
+
64
+ ```typescript
65
+ new MastraStorageExporter({
66
+ byteBatching: {
67
+ maxBatchBytes: 8 * 1024 * 1024,
68
+ maxConcurrentWrites: 1,
69
+ },
70
+ })
71
+ ```
72
+
73
+ - `maxBatchBytes` triggers a write when buffered events reach 8 MiB by default. Larger records are sent intact, without truncation or size-based drops.
74
+ - `maxConcurrentWrites` controls concurrent storage writes. The default is one. Update-based tracing strategies always use one write at a time to preserve span ordering.
75
+
76
+ Record-count and timer-based flush triggers still apply. Queued records are retained when storage falls behind, so queue memory can grow. Without `byteBatching`, the exporter keeps its existing count-based batching behavior.
77
+
78
+ Inspect the current queue with `exporter.getByteBatchingStats()`.
79
+
50
80
  ## `TracingStorageStrategy`
51
81
 
52
82
  ```typescript
@@ -1,5 +1,6 @@
1
1
  import type { AnyExportedSpan, ObservabilityEvent } from '@mastra/core/observability';
2
2
  import type { CreateSpanRecord, ObservabilityStorageStrategy, UpdateSpanRecord } from '@mastra/core/storage';
3
+ import type { StorageByteTracker } from './storage-byte-tracker.js';
3
4
  /** Mixin interface that tracks how many times a buffered event has been retried. */
4
5
  export interface RetryCount {
5
6
  retryCount: number;
@@ -21,6 +22,7 @@ export declare class EventBuffer {
21
22
  #private;
22
23
  constructor(args: {
23
24
  maxRetries: number;
25
+ byteTracker?: StorageByteTracker;
24
26
  });
25
27
  /** Initialize with a storage strategy and replay any pre-init events. */
26
28
  init(args: {
@@ -37,6 +39,13 @@ export declare class EventBuffer {
37
39
  reAddCreates(events: BufferedEvent[]): BufferedEvent[];
38
40
  /** Re-add failed update events to the buffer, returning events that exceed max retries. */
39
41
  reAddUpdates(events: BufferedEvent[]): BufferedEvent[];
42
+ /** Alternate creates and eligible updates so either queue can make progress under load. */
43
+ takeByteBatch(maxRecords: number): {
44
+ creates: BufferedEvent[];
45
+ updates: BufferedEvent[];
46
+ };
47
+ /** Retries/deferred updates remain reserved; everything else has finished or been dropped. */
48
+ releaseByteBatch(events: BufferedEvent[]): void;
40
49
  /** Snapshot of buffered create events. */
41
50
  get creates(): BufferedEvent[];
42
51
  /** Snapshot of buffered update events. */
@@ -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;AAE7G,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,aAAa,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAE5D;;;;GAIG;AACH,qBAAa,WAAW;;IAWtB,YAAY,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,EAEvC;IAED,yEAAyE;IACzE,IAAI,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,4BAA4B,CAAA;KAAE,GAAG,IAAI,CAQ3D;IAED,qEAAqE;IACrE,KAAK,SAIJ;IAED,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;IAKlB,gGAAgG;IAChG,QAAQ,CAAC,KAAK,EAAE,kBAAkB,QAsDjC;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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,10 +1,14 @@
1
1
  import type { TracingEvent, LogEvent, MetricEvent, ScoreEvent, FeedbackEvent } from '@mastra/core/observability';
2
2
  import { BaseExporter } from './base.js';
3
3
  import type { BaseExporterConfig } from './base.js';
4
+ import type { PlatformByteBatchingConfig, PlatformByteBatchingStats } from './platform-byte-batcher.js';
5
+ export type { PlatformByteBatchingConfig, PlatformByteBatchingStats } from './platform-byte-batcher.js';
4
6
  export interface MastraPlatformExporterConfig extends BaseExporterConfig {
5
7
  maxBatchSize?: number;
6
8
  maxBatchWaitMs?: number;
7
9
  maxRetries?: number;
10
+ /** Opt into UTF-8 JSON byte flush thresholds and upload concurrency control. */
11
+ byteBatching?: PlatformByteBatchingConfig;
8
12
  accessToken?: string;
9
13
  projectId?: string;
10
14
  /**
@@ -37,6 +41,8 @@ export declare class MastraPlatformExporter extends BaseExporter {
37
41
  private quotaProbeTimer;
38
42
  private quotaProbeIntervalSeconds;
39
43
  private shuttingDown;
44
+ private byteBatcher?;
45
+ private byteUploadTimeoutMs?;
40
46
  constructor(config?: MastraPlatformExporterConfig);
41
47
  protected _exportTracingEvent(event: TracingEvent): Promise<void>;
42
48
  onLogEvent(event: LogEvent): Promise<void>;
@@ -64,6 +70,7 @@ export declare class MastraPlatformExporter extends BaseExporter {
64
70
  private buildPublishHeaders;
65
71
  private buildPublishBody;
66
72
  private batchUpload;
73
+ private uploadBody;
67
74
  /**
68
75
  * Enter the quota-exhausted paused state: drop buffered events, stop the
69
76
  * flush timer, and start probing until the collector stops rejecting with
@@ -79,6 +86,9 @@ export declare class MastraPlatformExporter extends BaseExporter {
79
86
  * captures it to keep the retry-after hint.
80
87
  */
81
88
  private probeQuotaStatus;
89
+ /** Current queued and active serialized JSON bytes; undefined in count mode. */
90
+ getByteBatchingStats(): PlatformByteBatchingStats | undefined;
91
+ private flushByteBatch;
82
92
  private flushSignalBatch;
83
93
  private resetBuffer;
84
94
  /**
@@ -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,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGjD,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MA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AWzB,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,CA8B3B;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAqC9B;CACF"}
@@ -2,8 +2,11 @@ import type { TracingEvent, InitExporterOptions, MetricEvent, LogEvent, ScoreEve
2
2
  import type { TracingStorageStrategy } from '@mastra/core/storage';
3
3
  import type { BaseExporterConfig } from './base.js';
4
4
  import { BaseExporter } from './base.js';
5
+ import type { StorageByteBatchingConfig, StorageByteBatchingStats } from './storage-byte-tracker.js';
6
+ export type { StorageByteBatchingConfig, StorageByteBatchingStats } from './storage-byte-tracker.js';
5
7
  /** Configuration for the MastraStorageExporter's batching, retry, and strategy behavior. */
6
8
  export interface MastraStorageExporterConfig extends BaseExporterConfig {
9
+ byteBatching?: StorageByteBatchingConfig;
7
10
  maxBatchSize?: number;
8
11
  maxBufferSize?: number;
9
12
  maxBatchWaitMs?: number;
@@ -83,6 +86,7 @@ export declare class MastraStorageExporter extends BaseExporter {
83
86
  * Completed spans (SPAN_ENDED) are cleaned up from allCreatedSpans after success.
84
87
  */
85
88
  private flushBuffer;
89
+ getByteBatchingStats(): StorageByteBatchingStats | undefined;
86
90
  _exportTracingEvent(event: TracingEvent): Promise<void>;
87
91
  /**
88
92
  * Handle metric events — buffer for batch flush.
@@ -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,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;AAKtC,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;AAoCD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;;IACrD,IAAI,SAA6B;IAkBjC,YAAY,MAAM,GAAE,2BAAgC,EAenD;IAED;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQtD;IAED,OAAO,CAAC,eAAe;YAUT,iBAAiB;YA6CjB,iBAAiB;IAS/B;;OAEG;IACH,OAAO,CAAC,WAAW;IAyBnB;;OAEG;IACH,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC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