@mastra/observability 1.0.0-beta.1 → 1.0.0-beta.11

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 (40) hide show
  1. package/CHANGELOG.md +387 -0
  2. package/README.md +34 -79
  3. package/dist/config.d.ts +216 -6
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/default.d.ts.map +1 -1
  6. package/dist/exporters/base.d.ts +3 -2
  7. package/dist/exporters/base.d.ts.map +1 -1
  8. package/dist/exporters/cloud.d.ts.map +1 -1
  9. package/dist/exporters/default.d.ts +4 -3
  10. package/dist/exporters/default.d.ts.map +1 -1
  11. package/dist/exporters/index.d.ts +3 -2
  12. package/dist/exporters/index.d.ts.map +1 -1
  13. package/dist/exporters/test.d.ts +13 -0
  14. package/dist/exporters/test.d.ts.map +1 -0
  15. package/dist/exporters/tracking.d.ts +450 -0
  16. package/dist/exporters/tracking.d.ts.map +1 -0
  17. package/dist/index.cjs +5788 -232
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +5779 -233
  22. package/dist/index.js.map +1 -1
  23. package/dist/instances/base.d.ts +32 -5
  24. package/dist/instances/base.d.ts.map +1 -1
  25. package/dist/model-tracing.d.ts +16 -9
  26. package/dist/model-tracing.d.ts.map +1 -1
  27. package/dist/span_processors/sensitive-data-filter.d.ts +7 -0
  28. package/dist/span_processors/sensitive-data-filter.d.ts.map +1 -1
  29. package/dist/spans/base.d.ts +49 -18
  30. package/dist/spans/base.d.ts.map +1 -1
  31. package/dist/spans/default.d.ts.map +1 -1
  32. package/dist/spans/index.d.ts +1 -0
  33. package/dist/spans/index.d.ts.map +1 -1
  34. package/dist/spans/serialization.d.ts +46 -0
  35. package/dist/spans/serialization.d.ts.map +1 -0
  36. package/dist/tracing-options.d.ts +27 -0
  37. package/dist/tracing-options.d.ts.map +1 -0
  38. package/dist/usage.d.ts +21 -0
  39. package/dist/usage.d.ts.map +1 -0
  40. package/package.json +9 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,392 @@
1
1
  # @mastra/observability
2
2
 
3
+ ## 1.0.0-beta.11
4
+
5
+ ### Major Changes
6
+
7
+ - **Breaking Change**: Convert OUTPUT generic from `OutputSchema` constraint to plain generic ([#11741](https://github.com/mastra-ai/mastra/pull/11741))
8
+
9
+ This change removes the direct dependency on Zod typings in the public API by converting all `OUTPUT extends OutputSchema` generic constraints to plain `OUTPUT` generics throughout the codebase. This is preparation for moving to a standard schema approach.
10
+ - All generic type parameters previously constrained to `OutputSchema` (e.g., `<OUTPUT extends OutputSchema = undefined>`) are now plain generics with defaults (e.g., `<OUTPUT = undefined>`)
11
+ - Affects all public APIs including `Agent`, `MastraModelOutput`, `AgentExecutionOptions`, and stream/generate methods
12
+ - `InferSchemaOutput<OUTPUT>` replaced with `OUTPUT` throughout
13
+ - `PartialSchemaOutput<OUTPUT>` replaced with `Partial<OUTPUT>`
14
+ - Schema fields now use `NonNullable<OutputSchema<OUTPUT>>` instead of `OUTPUT` directly
15
+ - Added `FullOutput<OUTPUT>` type representing complete output with all fields
16
+ - Added `AgentExecutionOptionsBase<OUTPUT>` type
17
+ - `getFullOutput()` method now returns `Promise<FullOutput<OUTPUT>>`
18
+ - `Agent` class now generic: `Agent<TAgentId, TTools, TOutput>`
19
+ - `agent.generate()` and `agent.stream()` methods have updated signatures
20
+ - `MastraModelOutput<OUTPUT>` no longer requires `OutputSchema` constraint
21
+ - Network route and streaming APIs updated to use plain OUTPUT generic
22
+
23
+ **Before:**
24
+
25
+ ```typescript
26
+ const output = await agent.generate<z.ZodType>({
27
+ messages: [...],
28
+ structuredOutput: { schema: mySchema }
29
+ });
30
+
31
+ **After:**
32
+ const output = await agent.generate<z.infer<typeof mySchema>>({
33
+ messages: [...],
34
+ structuredOutput: { schema: mySchema }
35
+ });
36
+ // Or rely on type inference:
37
+ const output = await agent.generate({
38
+ messages: [...],
39
+ structuredOutput: { schema: mySchema }
40
+ });
41
+
42
+ ```
43
+
44
+ ### Minor Changes
45
+
46
+ - Add `hideInput` and `hideOutput` options to `TracingOptions` for protecting sensitive data in traces. ([#11969](https://github.com/mastra-ai/mastra/pull/11969))
47
+
48
+ When set to `true`, these options hide input/output data from all spans in a trace, including child spans. This is useful for protecting sensitive information from being logged to observability platforms.
49
+
50
+ ```typescript
51
+ const agent = mastra.getAgent('myAgent');
52
+ await agent.generate('Process this sensitive data', {
53
+ tracingOptions: {
54
+ hideInput: true, // Input will be hidden from all spans
55
+ hideOutput: true, // Output will be hidden from all spans
56
+ },
57
+ });
58
+ ```
59
+
60
+ The options can be used independently (hide only input or only output) or together. The settings are propagated to all child spans via `TraceState`, ensuring consistent behavior across the entire trace.
61
+
62
+ Fixes #10888
63
+
64
+ - Added `TrackingExporter` base class with improved handling for: ([#11870](https://github.com/mastra-ai/mastra/pull/11870))
65
+ - **Out-of-order span processing**: Spans that arrive before their parents are now queued and processed once dependencies are available
66
+ - **Delayed cleanup**: Trace data is retained briefly after spans end to handle late-arriving updates
67
+ - **Memory management**: Configurable limits on pending and total traces to prevent memory leaks
68
+
69
+ New configuration options on `TrackingExporterConfig`:
70
+ - `earlyQueueMaxAttempts` - Max retry attempts for queued events (default: 5)
71
+ - `earlyQueueTTLMs` - TTL for queued events in ms (default: 30000)
72
+ - `traceCleanupDelayMs` - Delay before cleaning up completed traces (default: 30000)
73
+ - `maxPendingCleanupTraces` - Soft cap on traces awaiting cleanup (default: 100)
74
+ - `maxTotalTraces` - Hard cap on total traces (default: 500)
75
+
76
+ Updated @mastra/braintrust, @mastra/langfuse, @mastra/langsmith, @mastra/posthog to use the new TrackingExporter
77
+
78
+ ### Patch Changes
79
+
80
+ - feat(spans): implement entity inheritance for child spans ([#11914](https://github.com/mastra-ai/mastra/pull/11914))
81
+
82
+ Added tests to verify that child spans inherit entityId and entityName from their parent spans when not explicitly provided. Also included functionality to allow child spans to override these inherited values. This ensures proper entity identification across multiple levels of span hierarchy.
83
+
84
+ - Improved tracing by filtering infrastructure chunks from model streams and adding success attribute to tool spans. ([#11943](https://github.com/mastra-ai/mastra/pull/11943))
85
+
86
+ Added generic input/output attribute mapping for additional span types in Arize exporter.
87
+
88
+ - Real-time span export for Inngest workflow engine ([#11973](https://github.com/mastra-ai/mastra/pull/11973))
89
+ - Spans are now exported immediately when created and ended, instead of being batched at workflow completion
90
+ - Added durable span lifecycle hooks (`createStepSpan`, `endStepSpan`, `errorStepSpan`, `createChildSpan`, `endChildSpan`, `errorChildSpan`) that wrap span operations in Inngest's `step.run()` for memoization
91
+ - Added `rebuildSpan()` method to reconstruct span objects from exported data after Inngest replay
92
+ - Fixed nested workflow step spans missing output data
93
+ - Spans correctly maintain parent-child relationships across Inngest's durable execution boundaries using `tracingIds`
94
+
95
+ - Updated dependencies [[`ebae12a`](https://github.com/mastra-ai/mastra/commit/ebae12a2dd0212e75478981053b148a2c246962d), [`c61a0a5`](https://github.com/mastra-ai/mastra/commit/c61a0a5de4904c88fd8b3718bc26d1be1c2ec6e7), [`69136e7`](https://github.com/mastra-ai/mastra/commit/69136e748e32f57297728a4e0f9a75988462f1a7), [`449aed2`](https://github.com/mastra-ai/mastra/commit/449aed2ba9d507b75bf93d427646ea94f734dfd1), [`eb648a2`](https://github.com/mastra-ai/mastra/commit/eb648a2cc1728f7678768dd70cd77619b448dab9), [`0131105`](https://github.com/mastra-ai/mastra/commit/0131105532e83bdcbb73352fc7d0879eebf140dc), [`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`b00ccd3`](https://github.com/mastra-ai/mastra/commit/b00ccd325ebd5d9e37e34dd0a105caae67eb568f), [`3bdfa75`](https://github.com/mastra-ai/mastra/commit/3bdfa7507a91db66f176ba8221aa28dd546e464a), [`e770de9`](https://github.com/mastra-ai/mastra/commit/e770de941a287a49b1964d44db5a5763d19890a6), [`52e2716`](https://github.com/mastra-ai/mastra/commit/52e2716b42df6eff443de72360ae83e86ec23993), [`27b4040`](https://github.com/mastra-ai/mastra/commit/27b4040bfa1a95d92546f420a02a626b1419a1d6), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151), [`8dc7f55`](https://github.com/mastra-ai/mastra/commit/8dc7f55900395771da851dc7d78d53ae84fe34ec), [`8379099`](https://github.com/mastra-ai/mastra/commit/8379099fc467af6bef54dd7f80c9bd75bf8bbddf), [`8c0ec25`](https://github.com/mastra-ai/mastra/commit/8c0ec25646c8a7df253ed1e5ff4863a0d3f1316c), [`ff4d9a6`](https://github.com/mastra-ai/mastra/commit/ff4d9a6704fc87b31a380a76ed22736fdedbba5a), [`69821ef`](https://github.com/mastra-ai/mastra/commit/69821ef806482e2c44e2197ac0b050c3fe3a5285), [`1ed5716`](https://github.com/mastra-ai/mastra/commit/1ed5716830867b3774c4a1b43cc0d82935f32b96), [`4186bdd`](https://github.com/mastra-ai/mastra/commit/4186bdd00731305726fa06adba0b076a1d50b49f), [`7aaf973`](https://github.com/mastra-ai/mastra/commit/7aaf973f83fbbe9521f1f9e7a4fd99b8de464617)]:
96
+ - @mastra/core@1.0.0-beta.22
97
+
98
+ ## 1.0.0-beta.10
99
+
100
+ ### Minor Changes
101
+
102
+ - Deprecate `default: { enabled: true }` observability configuration ([#11674](https://github.com/mastra-ai/mastra/pull/11674))
103
+
104
+ The shorthand `default: { enabled: true }` configuration is now deprecated and will be removed in a future version. Users should migrate to explicit configuration with `DefaultExporter`, `CloudExporter`, and `SensitiveDataFilter`.
105
+
106
+ **Before (deprecated):**
107
+
108
+ ```typescript
109
+ import { Observability } from '@mastra/observability';
110
+
111
+ const mastra = new Mastra({
112
+ observability: new Observability({
113
+ default: { enabled: true },
114
+ }),
115
+ });
116
+ ```
117
+
118
+ **After (recommended):**
119
+
120
+ ```typescript
121
+ import { Observability, DefaultExporter, CloudExporter, SensitiveDataFilter } from '@mastra/observability';
122
+
123
+ const mastra = new Mastra({
124
+ observability: new Observability({
125
+ configs: {
126
+ default: {
127
+ serviceName: 'mastra',
128
+ exporters: [new DefaultExporter(), new CloudExporter()],
129
+ spanOutputProcessors: [new SensitiveDataFilter()],
130
+ },
131
+ },
132
+ }),
133
+ });
134
+ ```
135
+
136
+ The explicit configuration makes it clear exactly what exporters and processors are being used, improving code readability and maintainability.
137
+
138
+ A deprecation warning will be logged when using the old configuration pattern.
139
+
140
+ - Fix processor tracing to create individual spans per processor ([#11683](https://github.com/mastra-ai/mastra/pull/11683))
141
+ - Processor spans now correctly show processor IDs (e.g., `input processor: validator`) instead of combined workflow IDs
142
+ - Each processor in a chain gets its own trace span, improving observability into processor execution
143
+ - Spans are only created for phases a processor actually implements, eliminating empty spans
144
+ - Internal agent calls within processors now properly nest under their processor span
145
+ - Added `INPUT_STEP_PROCESSOR` and `OUTPUT_STEP_PROCESSOR` entity types for finer-grained tracing
146
+ - Changed `processorType` span attribute to `processorExecutor` with values `'workflow'` or `'legacy'`
147
+
148
+ ### Patch Changes
149
+
150
+ - Add embedded documentation support for Mastra packages ([#11472](https://github.com/mastra-ai/mastra/pull/11472))
151
+
152
+ Mastra packages now include embedded documentation in the published npm package under `dist/docs/`. This enables coding agents and AI assistants to understand and use the framework by reading documentation directly from `node_modules`.
153
+
154
+ Each package includes:
155
+ - **SKILL.md** - Entry point explaining the package's purpose and capabilities
156
+ - **SOURCE_MAP.json** - Machine-readable index mapping exports to types and implementation files
157
+ - **Topic folders** - Conceptual documentation organized by feature area
158
+
159
+ Documentation is driven by the `packages` frontmatter field in MDX files, which maps docs to their corresponding packages. CI validation ensures all docs include this field.
160
+
161
+ - Fix trace-level sampling to sample entire traces instead of individual spans ([#11676](https://github.com/mastra-ai/mastra/pull/11676))
162
+
163
+ Previously, sampling decisions were made independently for each span, causing fragmented traces where some spans were sampled and others were not. This defeated the purpose of ratio or custom sampling strategies.
164
+
165
+ Now:
166
+ - Sampling decisions are made once at the root span level
167
+ - Child spans inherit the sampling decision from their parent
168
+ - Custom samplers are only called once per trace (for root spans)
169
+ - Either all spans in a trace are sampled, or none are
170
+
171
+ Fixes #11504
172
+
173
+ - Updated dependencies [[`d2d3e22`](https://github.com/mastra-ai/mastra/commit/d2d3e22a419ee243f8812a84e3453dd44365ecb0), [`bc72b52`](https://github.com/mastra-ai/mastra/commit/bc72b529ee4478fe89ecd85a8be47ce0127b82a0), [`05b8bee`](https://github.com/mastra-ai/mastra/commit/05b8bee9e50e6c2a4a2bf210eca25ee212ca24fa), [`c042bd0`](https://github.com/mastra-ai/mastra/commit/c042bd0b743e0e86199d0cb83344ca7690e34a9c), [`940a2b2`](https://github.com/mastra-ai/mastra/commit/940a2b27480626ed7e74f55806dcd2181c1dd0c2), [`e0941c3`](https://github.com/mastra-ai/mastra/commit/e0941c3d7fc75695d5d258e7008fd5d6e650800c), [`0c0580a`](https://github.com/mastra-ai/mastra/commit/0c0580a42f697cd2a7d5973f25bfe7da9055038a), [`28f5f89`](https://github.com/mastra-ai/mastra/commit/28f5f89705f2409921e3c45178796c0e0d0bbb64), [`e601b27`](https://github.com/mastra-ai/mastra/commit/e601b272c70f3a5ecca610373aa6223012704892), [`3d3366f`](https://github.com/mastra-ai/mastra/commit/3d3366f31683e7137d126a3a57174a222c5801fb), [`5a4953f`](https://github.com/mastra-ai/mastra/commit/5a4953f7d25bb15ca31ed16038092a39cb3f98b3), [`eb9e522`](https://github.com/mastra-ai/mastra/commit/eb9e522ce3070a405e5b949b7bf5609ca51d7fe2), [`20e6f19`](https://github.com/mastra-ai/mastra/commit/20e6f1971d51d3ff6dd7accad8aaaae826d540ed), [`4f0b3c6`](https://github.com/mastra-ai/mastra/commit/4f0b3c66f196c06448487f680ccbb614d281e2f7), [`74c4f22`](https://github.com/mastra-ai/mastra/commit/74c4f22ed4c71e72598eacc346ba95cdbc00294f), [`81b6a8f`](https://github.com/mastra-ai/mastra/commit/81b6a8ff79f49a7549d15d66624ac1a0b8f5f971), [`e4d366a`](https://github.com/mastra-ai/mastra/commit/e4d366aeb500371dd4210d6aa8361a4c21d87034), [`a4f010b`](https://github.com/mastra-ai/mastra/commit/a4f010b22e4355a5fdee70a1fe0f6e4a692cc29e), [`73b0bb3`](https://github.com/mastra-ai/mastra/commit/73b0bb394dba7c9482eb467a97ab283dbc0ef4db), [`5627a8c`](https://github.com/mastra-ai/mastra/commit/5627a8c6dc11fe3711b3fa7a6ffd6eb34100a306), [`3ff45d1`](https://github.com/mastra-ai/mastra/commit/3ff45d10e0c80c5335a957ab563da72feb623520), [`251df45`](https://github.com/mastra-ai/mastra/commit/251df4531407dfa46d805feb40ff3fb49769f455), [`f894d14`](https://github.com/mastra-ai/mastra/commit/f894d148946629af7b1f452d65a9cf864cec3765), [`c2b9547`](https://github.com/mastra-ai/mastra/commit/c2b9547bf435f56339f23625a743b2147ab1c7a6), [`580b592`](https://github.com/mastra-ai/mastra/commit/580b5927afc82fe460dfdf9a38a902511b6b7e7f), [`58e3931`](https://github.com/mastra-ai/mastra/commit/58e3931af9baa5921688566210f00fb0c10479fa), [`08bb631`](https://github.com/mastra-ai/mastra/commit/08bb631ae2b14684b2678e3549d0b399a6f0561e), [`4fba91b`](https://github.com/mastra-ai/mastra/commit/4fba91bec7c95911dc28e369437596b152b04cd0), [`12b0cc4`](https://github.com/mastra-ai/mastra/commit/12b0cc4077d886b1a552637dedb70a7ade93528c)]:
174
+ - @mastra/core@1.0.0-beta.20
175
+
176
+ ## 1.0.0-beta.9
177
+
178
+ ### Patch Changes
179
+
180
+ - Fix SensitiveDataFilter destroying Date objects ([#11437](https://github.com/mastra-ai/mastra/pull/11437))
181
+
182
+ The `deepFilter` method now correctly preserves `Date` objects instead of converting them to empty objects `{}`. This fixes issues with downstream exporters like `BraintrustExporter` that rely on `Date` methods like `getTime()`.
183
+
184
+ Previously, `Object.keys(new Date())` returned `[]`, causing Date objects to be incorrectly converted to `{}`. The fix adds an explicit check for `Date` instances before generic object processing.
185
+
186
+ - Updated dependencies [[`5947fcd`](https://github.com/mastra-ai/mastra/commit/5947fcdd425531f29f9422026d466c2ee3113c93)]:
187
+ - @mastra/core@1.0.0-beta.18
188
+
189
+ ## 1.0.0-beta.8
190
+
191
+ ### Patch Changes
192
+
193
+ - fix(observability): start MODEL_STEP span at beginning of LLM execution ([#11409](https://github.com/mastra-ai/mastra/pull/11409))
194
+
195
+ The MODEL_STEP span was being created when the step-start chunk arrived (after the model API call completed), causing the span's startTime to be close to its endTime instead of accurately reflecting when the step began.
196
+
197
+ This fix ensures MODEL_STEP spans capture the full duration of each LLM execution step, including the API call latency, by starting the span at the beginning of the step execution rather than when the response starts streaming.
198
+
199
+ Fixes #11271
200
+
201
+ - Updated dependencies [[`3d93a15`](https://github.com/mastra-ai/mastra/commit/3d93a15796b158c617461c8b98bede476ebb43e2), [`efe406a`](https://github.com/mastra-ai/mastra/commit/efe406a1353c24993280ebc2ed61dd9f65b84b26), [`119e5c6`](https://github.com/mastra-ai/mastra/commit/119e5c65008f3e5cfca954eefc2eb85e3bf40da4), [`74e504a`](https://github.com/mastra-ai/mastra/commit/74e504a3b584eafd2f198001c6a113bbec589fd3), [`e33fdbd`](https://github.com/mastra-ai/mastra/commit/e33fdbd07b33920d81e823122331b0c0bee0bb59), [`929f69c`](https://github.com/mastra-ai/mastra/commit/929f69c3436fa20dd0f0e2f7ebe8270bd82a1529), [`8a73529`](https://github.com/mastra-ai/mastra/commit/8a73529ca01187f604b1f3019d0a725ac63ae55f)]:
202
+ - @mastra/core@1.0.0-beta.16
203
+
204
+ ## 1.0.0-beta.7
205
+
206
+ ### Minor Changes
207
+
208
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
209
+
210
+ ## What changed
211
+
212
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
213
+
214
+ **Before:**
215
+
216
+ ```typescript
217
+ // Old span structure
218
+ span.agentId; // 'my-agent'
219
+ span.toolId; // undefined
220
+ span.workflowId; // undefined
221
+ ```
222
+
223
+ **After:**
224
+
225
+ ```typescript
226
+ // New span structure
227
+ span.entityType; // EntityType.AGENT
228
+ span.entityId; // 'my-agent'
229
+ span.entityName; // 'My Agent'
230
+ ```
231
+
232
+ ## New `listTraces()` API
233
+
234
+ Query traces with filtering, pagination, and sorting:
235
+
236
+ ```typescript
237
+ const { spans, pagination } = await storage.listTraces({
238
+ filters: {
239
+ entityType: EntityType.AGENT,
240
+ entityId: 'my-agent',
241
+ userId: 'user-123',
242
+ environment: 'production',
243
+ status: TraceStatus.SUCCESS,
244
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
245
+ },
246
+ pagination: { page: 0, perPage: 50 },
247
+ orderBy: { field: 'startedAt', direction: 'DESC' },
248
+ });
249
+ ```
250
+
251
+ **Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
252
+
253
+ ## New retrieval methods
254
+ - `getSpan({ traceId, spanId })` - Get a single span
255
+ - `getRootSpan({ traceId })` - Get the root span of a trace
256
+ - `getTrace({ traceId })` - Get all spans for a trace
257
+
258
+ ## Backward compatibility
259
+
260
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
261
+
262
+ ## Migration
263
+
264
+ **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
265
+
266
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
267
+
268
+ ### Patch Changes
269
+
270
+ - Refactor storage architecture to use domain-specific stores via `getStore()` pattern ([#11361](https://github.com/mastra-ai/mastra/pull/11361))
271
+
272
+ ### Summary
273
+
274
+ This release introduces a new storage architecture that replaces passthrough methods on `MastraStorage` with domain-specific storage interfaces accessed via `getStore()`. This change reduces code duplication across storage adapters and provides a cleaner, more modular API.
275
+
276
+ ### Migration Guide
277
+
278
+ All direct method calls on storage instances should be updated to use `getStore()`:
279
+
280
+ ```typescript
281
+ // Before
282
+ const thread = await storage.getThreadById({ threadId });
283
+ await storage.persistWorkflowSnapshot({ workflowName, runId, snapshot });
284
+ await storage.createSpan(span);
285
+
286
+ // After
287
+ const memory = await storage.getStore('memory');
288
+ const thread = await memory?.getThreadById({ threadId });
289
+
290
+ const workflows = await storage.getStore('workflows');
291
+ await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
292
+
293
+ const observability = await storage.getStore('observability');
294
+ await observability?.createSpan(span);
295
+ ```
296
+
297
+ ### Available Domains
298
+ - **`memory`**: Thread and message operations (`getThreadById`, `saveThread`, `saveMessages`, etc.)
299
+ - **`workflows`**: Workflow state persistence (`persistWorkflowSnapshot`, `loadWorkflowSnapshot`, `getWorkflowRunById`, etc.)
300
+ - **`scores`**: Evaluation scores (`saveScore`, `listScoresByScorerId`, etc.)
301
+ - **`observability`**: Tracing and spans (`createSpan`, `updateSpan`, `getTrace`, etc.)
302
+ - **`agents`**: Stored agent configurations (`createAgent`, `getAgentById`, `listAgents`, etc.)
303
+
304
+ ### Breaking Changes
305
+ - Passthrough methods have been removed from `MastraStorage` base class
306
+ - All storage adapters now require accessing domains via `getStore()`
307
+ - The `stores` property on storage instances is now the canonical way to access domain storage
308
+
309
+ ### Internal Changes
310
+ - Each storage adapter now initializes domain-specific stores in its constructor
311
+ - Domain stores share database connections and handle their own table initialization
312
+
313
+ - Updated dependencies [[`33a4d2e`](https://github.com/mastra-ai/mastra/commit/33a4d2e4ed8af51f69256232f00c34d6b6b51d48), [`4aaa844`](https://github.com/mastra-ai/mastra/commit/4aaa844a4f19d054490f43638a990cc57bda8d2f), [`4a1a6cb`](https://github.com/mastra-ai/mastra/commit/4a1a6cb3facad54b2bb6780b00ce91d6de1edc08), [`31d13d5`](https://github.com/mastra-ai/mastra/commit/31d13d5fdc2e2380e2e3ee3ec9fb29d2a00f265d), [`4c62166`](https://github.com/mastra-ai/mastra/commit/4c621669f4a29b1f443eca3ba70b814afa286266), [`7bcbf10`](https://github.com/mastra-ai/mastra/commit/7bcbf10133516e03df964b941f9a34e9e4ab4177), [`4353600`](https://github.com/mastra-ai/mastra/commit/43536005a65988a8eede236f69122e7f5a284ba2), [`6986fb0`](https://github.com/mastra-ai/mastra/commit/6986fb064f5db6ecc24aa655e1d26529087b43b3), [`053e979`](https://github.com/mastra-ai/mastra/commit/053e9793b28e970086b0507f7f3b76ea32c1e838), [`e26dc9c`](https://github.com/mastra-ai/mastra/commit/e26dc9c3ccfec54ae3dc3e2b2589f741f9ae60a6), [`55edf73`](https://github.com/mastra-ai/mastra/commit/55edf7302149d6c964fbb7908b43babfc2b52145), [`27c0009`](https://github.com/mastra-ai/mastra/commit/27c0009777a6073d7631b0eb7b481d94e165b5ca), [`dee388d`](https://github.com/mastra-ai/mastra/commit/dee388dde02f2e63c53385ae69252a47ab6825cc), [`3f3fc30`](https://github.com/mastra-ai/mastra/commit/3f3fc3096f24c4a26cffeecfe73085928f72aa63), [`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`10c2735`](https://github.com/mastra-ai/mastra/commit/10c27355edfdad1ee2b826b897df74125eb81fb8), [`1924cf0`](https://github.com/mastra-ai/mastra/commit/1924cf06816e5e4d4d5333065ec0f4bb02a97799), [`b339816`](https://github.com/mastra-ai/mastra/commit/b339816df0984d0243d944ac2655d6ba5f809cde)]:
314
+ - @mastra/core@1.0.0-beta.15
315
+
316
+ ## 1.0.0-beta.6
317
+
318
+ ### Patch Changes
319
+
320
+ - Limits the size of large payloads in span data. ([#11237](https://github.com/mastra-ai/mastra/pull/11237))
321
+
322
+ - Updated dependencies [[`4f94ed8`](https://github.com/mastra-ai/mastra/commit/4f94ed8177abfde3ec536e3574883e075423350c), [`ac3cc23`](https://github.com/mastra-ai/mastra/commit/ac3cc2397d1966bc0fc2736a223abc449d3c7719), [`a86f4df`](https://github.com/mastra-ai/mastra/commit/a86f4df0407311e0d2ea49b9a541f0938810d6a9), [`029540c`](https://github.com/mastra-ai/mastra/commit/029540ca1e582fc2dd8d288ecd4a9b0f31a954ef), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`01b20fe`](https://github.com/mastra-ai/mastra/commit/01b20fefb7c67c2b7d79417598ef4e60256d1225), [`0dbf199`](https://github.com/mastra-ai/mastra/commit/0dbf199110f22192ce5c95b1c8148d4872b4d119), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
323
+ - @mastra/core@1.0.0-beta.14
324
+
325
+ ## 1.0.0-beta.5
326
+
327
+ ### Patch Changes
328
+
329
+ - Move `zod` from `dependencies` to `devDependencies` as users should install it themselves to avoid version conflicts. ([#11114](https://github.com/mastra-ai/mastra/pull/11114))
330
+
331
+ - Updated dependencies [[`d5ed981`](https://github.com/mastra-ai/mastra/commit/d5ed981c8701c1b8a27a5f35a9a2f7d9244e695f), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`932d63d`](https://github.com/mastra-ai/mastra/commit/932d63dd51be9c8bf1e00e3671fe65606c6fb9cd), [`b760b73`](https://github.com/mastra-ai/mastra/commit/b760b731aca7c8a3f041f61d57a7f125ae9cb215), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`2b459f4`](https://github.com/mastra-ai/mastra/commit/2b459f466fd91688eeb2a44801dc23f7f8a887ab), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`24b76d8`](https://github.com/mastra-ai/mastra/commit/24b76d8e17656269c8ed09a0c038adb9cc2ae95a), [`243a823`](https://github.com/mastra-ai/mastra/commit/243a8239c5906f5c94e4f78b54676793f7510ae3), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`c61fac3`](https://github.com/mastra-ai/mastra/commit/c61fac3add96f0dcce0208c07415279e2537eb62), [`6f14f70`](https://github.com/mastra-ai/mastra/commit/6f14f706ccaaf81b69544b6c1b75ab66a41e5317), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`4524734`](https://github.com/mastra-ai/mastra/commit/45247343e384717a7c8404296275c56201d6470f), [`2a53598`](https://github.com/mastra-ai/mastra/commit/2a53598c6d8cfeb904a7fc74e57e526d751c8fa6), [`c7cd3c7`](https://github.com/mastra-ai/mastra/commit/c7cd3c7a187d7aaf79e2ca139de328bf609a14b4), [`847c212`](https://github.com/mastra-ai/mastra/commit/847c212caba7df0d6f2fc756b494ac3c75c3720d), [`6f941c4`](https://github.com/mastra-ai/mastra/commit/6f941c438ca5f578619788acc7608fc2e23bd176)]:
332
+ - @mastra/core@1.0.0-beta.12
333
+
334
+ ## 1.0.0-beta.4
335
+
336
+ ### Patch Changes
337
+
338
+ - Fixed CachedToken tracking in all Observability Exporters. Also fixed TimeToFirstToken in Langfuse, Braintrust, PostHog exporters. Fixed trace formatting in Posthog Exporter. ([#11029](https://github.com/mastra-ai/mastra/pull/11029))
339
+
340
+ - Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
341
+ - @mastra/core@1.0.0-beta.10
342
+
343
+ ## 1.0.0-beta.3
344
+
345
+ ### Patch Changes
346
+
347
+ - Add time-to-first-token (TTFT) support for Braintrust integration ([#10840](https://github.com/mastra-ai/mastra/pull/10840))
348
+
349
+ Adds `time_to_first_token` metric to Braintrust spans, populated from the `completionStartTime` attribute captured when the first streaming chunk arrives.
350
+
351
+ ```typescript
352
+ // time_to_first_token is now automatically sent to Braintrust
353
+ // as part of span metrics during streaming
354
+ const result = await agent.stream('Hello');
355
+ ```
356
+
357
+ - Add time-to-first-token (TTFT) support for Langfuse integration ([#10781](https://github.com/mastra-ai/mastra/pull/10781))
358
+
359
+ Adds `completionStartTime` to model generation spans, which Langfuse uses to calculate TTFT metrics. The timestamp is automatically captured when the first content chunk arrives during streaming.
360
+
361
+ ```typescript
362
+ // completionStartTime is now automatically captured and sent to Langfuse
363
+ // enabling TTFT metrics in your Langfuse dashboard
364
+ const result = await agent.stream('Hello');
365
+ ```
366
+
367
+ - Consolidated tool-output chunks from nested agents into single tool-result spans ([#10836](https://github.com/mastra-ai/mastra/pull/10836))
368
+
369
+ - link langfuse prompts and helper functions ([#10738](https://github.com/mastra-ai/mastra/pull/10738))
370
+
371
+ - Updated dependencies [[`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`85d7ee1`](https://github.com/mastra-ai/mastra/commit/85d7ee18ff4e14d625a8a30ec6656bb49804989b), [`c6c1092`](https://github.com/mastra-ai/mastra/commit/c6c1092f8fbf76109303f69e000e96fd1960c4ce), [`81dc110`](https://github.com/mastra-ai/mastra/commit/81dc11008d147cf5bdc8996ead1aa61dbdebb6fc), [`7aedb74`](https://github.com/mastra-ai/mastra/commit/7aedb74883adf66af38e270e4068fd42e7a37036), [`8f02d80`](https://github.com/mastra-ai/mastra/commit/8f02d800777397e4b45d7f1ad041988a8b0c6630), [`d7aad50`](https://github.com/mastra-ai/mastra/commit/d7aad501ce61646b76b4b511e558ac4eea9884d0), [`ce0a73a`](https://github.com/mastra-ai/mastra/commit/ce0a73abeaa75b10ca38f9e40a255a645d50ebfb), [`a02e542`](https://github.com/mastra-ai/mastra/commit/a02e542d23179bad250b044b17ff023caa61739f), [`a372c64`](https://github.com/mastra-ai/mastra/commit/a372c640ad1fd12e8f0613cebdc682fc156b4d95), [`8846867`](https://github.com/mastra-ai/mastra/commit/8846867ffa9a3746767618e314bebac08eb77d87), [`42a42cf`](https://github.com/mastra-ai/mastra/commit/42a42cf3132b9786feecbb8c13c583dce5b0e198), [`ae08bf0`](https://github.com/mastra-ai/mastra/commit/ae08bf0ebc6a4e4da992b711c4a389c32ba84cf4), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`1d877b8`](https://github.com/mastra-ai/mastra/commit/1d877b8d7b536a251c1a7a18db7ddcf4f68d6f8b)]:
372
+ - @mastra/core@1.0.0-beta.7
373
+
374
+ ## 1.0.0-beta.2
375
+
376
+ ### Minor Changes
377
+
378
+ - Adds trace tagging support to the BrainTrust and Langfuse tracing exporters. ([#10765](https://github.com/mastra-ai/mastra/pull/10765))
379
+
380
+ - Adds bidirectional integration with otel tracing via a new @mastra/otel-bridge package. ([#10482](https://github.com/mastra-ai/mastra/pull/10482))
381
+
382
+ ### Patch Changes
383
+
384
+ - Fix SensitiveDataFilter to redact structured data in JSON strings ([#10776](https://github.com/mastra-ai/mastra/pull/10776))
385
+ - Fixed issue where SensitiveDataFilter failed to redact tool results in MODEL_STEP span input messages ([#9846](https://github.com/mastra-ai/mastra/issues/9846))
386
+
387
+ - Updated dependencies [[`ac0d2f4`](https://github.com/mastra-ai/mastra/commit/ac0d2f4ff8831f72c1c66c2be809706d17f65789), [`1a0d3fc`](https://github.com/mastra-ai/mastra/commit/1a0d3fc811482c9c376cdf79ee615c23bae9b2d6), [`85a628b`](https://github.com/mastra-ai/mastra/commit/85a628b1224a8f64cd82ea7f033774bf22df7a7e), [`c237233`](https://github.com/mastra-ai/mastra/commit/c23723399ccedf7f5744b3f40997b79246bfbe64), [`15f9e21`](https://github.com/mastra-ai/mastra/commit/15f9e216177201ea6e3f6d0bfb063fcc0953444f), [`ff94dea`](https://github.com/mastra-ai/mastra/commit/ff94dea935f4e34545c63bcb6c29804732698809), [`5b2ff46`](https://github.com/mastra-ai/mastra/commit/5b2ff4651df70c146523a7fca773f8eb0a2272f8), [`db41688`](https://github.com/mastra-ai/mastra/commit/db4168806d007417e2e60b4f68656dca4e5f40c9), [`5ca599d`](https://github.com/mastra-ai/mastra/commit/5ca599d0bb59a1595f19f58473fcd67cc71cef58), [`bff1145`](https://github.com/mastra-ai/mastra/commit/bff114556b3cbadad9b2768488708f8ad0e91475), [`5c8ca24`](https://github.com/mastra-ai/mastra/commit/5c8ca247094e0cc2cdbd7137822fb47241f86e77), [`e191844`](https://github.com/mastra-ai/mastra/commit/e1918444ca3f80e82feef1dad506cd4ec6e2875f), [`22553f1`](https://github.com/mastra-ai/mastra/commit/22553f11c63ee5e966a9c034a349822249584691), [`7237163`](https://github.com/mastra-ai/mastra/commit/72371635dbf96a87df4b073cc48fc655afbdce3d), [`2500740`](https://github.com/mastra-ai/mastra/commit/2500740ea23da067d6e50ec71c625ab3ce275e64), [`873ecbb`](https://github.com/mastra-ai/mastra/commit/873ecbb517586aa17d2f1e99283755b3ebb2863f), [`4f9bbe5`](https://github.com/mastra-ai/mastra/commit/4f9bbe5968f42c86f4930b8193de3c3c17e5bd36), [`02e51fe`](https://github.com/mastra-ai/mastra/commit/02e51feddb3d4155cfbcc42624fd0d0970d032c0), [`8f3fa3a`](https://github.com/mastra-ai/mastra/commit/8f3fa3a652bb77da092f913ec51ae46e3a7e27dc), [`cd29ad2`](https://github.com/mastra-ai/mastra/commit/cd29ad23a255534e8191f249593849ed29160886), [`bdf4d8c`](https://github.com/mastra-ai/mastra/commit/bdf4d8cdc656d8a2c21d81834bfa3bfa70f56c16), [`854e3da`](https://github.com/mastra-ai/mastra/commit/854e3dad5daac17a91a20986399d3a51f54bf68b), [`ce18d38`](https://github.com/mastra-ai/mastra/commit/ce18d38678c65870350d123955014a8432075fd9), [`cccf9c8`](https://github.com/mastra-ai/mastra/commit/cccf9c8b2d2dfc1a5e63919395b83d78c89682a0), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f0fdc14`](https://github.com/mastra-ai/mastra/commit/f0fdc14ee233d619266b3d2bbdeea7d25cfc6d13), [`db18bc9`](https://github.com/mastra-ai/mastra/commit/db18bc9c3825e2c1a0ad9a183cc9935f6691bfa1), [`9b37b56`](https://github.com/mastra-ai/mastra/commit/9b37b565e1f2a76c24f728945cc740c2b09be9da), [`41a23c3`](https://github.com/mastra-ai/mastra/commit/41a23c32f9877d71810f37e24930515df2ff7a0f), [`5d171ad`](https://github.com/mastra-ai/mastra/commit/5d171ad9ef340387276b77c2bb3e83e83332d729), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8), [`d1e74a0`](https://github.com/mastra-ai/mastra/commit/d1e74a0a293866dece31022047f5dbab65a304d0), [`39e7869`](https://github.com/mastra-ai/mastra/commit/39e7869bc7d0ee391077ce291474d8a84eedccff), [`5761926`](https://github.com/mastra-ai/mastra/commit/57619260c4a2cdd598763abbacd90de594c6bc76), [`c900fdd`](https://github.com/mastra-ai/mastra/commit/c900fdd504c41348efdffb205cfe80d48c38fa33), [`604a79f`](https://github.com/mastra-ai/mastra/commit/604a79fecf276e26a54a3fe01bb94e65315d2e0e), [`887f0b4`](https://github.com/mastra-ai/mastra/commit/887f0b4746cdbd7cb7d6b17ac9f82aeb58037ea5), [`2562143`](https://github.com/mastra-ai/mastra/commit/256214336b4faa78646c9c1776612393790d8784), [`ef11a61`](https://github.com/mastra-ai/mastra/commit/ef11a61920fa0ed08a5b7ceedd192875af119749)]:
388
+ - @mastra/core@1.0.0-beta.6
389
+
3
390
  ## 1.0.0-beta.1
4
391
 
5
392
  ### Patch Changes
package/README.md CHANGED
@@ -1,99 +1,54 @@
1
1
  # Mastra Observability
2
2
 
3
- A comprehensive observability system for AI operations in Mastra, providing type-safe span tracking, event-driven exports, and flexible tracing configuration.
3
+ Tracing and monitoring for AI operations in Mastra.
4
4
 
5
- ## Overview
5
+ ## Installation
6
6
 
7
- The Mastra Observability system enables detailed observability for AI-driven applications by tracking operations through spans that capture metadata, timing, and context. It's designed to work seamlessly with Mastra's architecture while providing flexible configuration and export options.
8
-
9
- ## Key Features
10
-
11
- - **Type-Safe Spans**: Strongly typed metadata based on span type prevents runtime errors
12
- - **Event-Driven Architecture**: Real-time tracing events for immediate observability
13
- - **OpenTelemetry Compatible**: Uses standard trace and span ID formats for integration
14
- - **Flexible Sampling**: Multiple sampling strategies with custom sampler support
15
- - **Pluggable Processors**: Modify or filter span fields before export
16
- - **Pluggable Exporters**: Multiple export formats and destinations
17
- - **Automatic Lifecycle Management**: Spans automatically emit events without manual intervention
18
-
19
- ## Quick Start
20
-
21
- ### Manual Tracing
22
-
23
- ```typescript
24
- import { DefaultObservabilityInstance, SpanType } from '@mastra/observability';
25
-
26
- // Create observability instance
27
- const observability = new DefaultObservabilityInstance({
28
- name: 'my-app',
29
- serviceName: 'my-app',
30
- });
31
-
32
- // Start an agent span
33
- const agentSpan = observability.startSpan({
34
- type: SpanType.AGENT_RUN,
35
- name: 'customer-support-agent',
36
- attributes: {
37
- agentId: 'agent-123',
38
- instructions: 'Help with customer support',
39
- maxSteps: 10,
40
- },
41
- });
42
-
43
- // Create child spans for nested operations
44
- const llmSpan = agentSpan.createChildSpan({
45
- type: SpanType.MODEL_GENERATION,
46
- name: 'gpt-4-response',
47
- attributes: {
48
- model: 'gpt-4',
49
- provider: 'openai',
50
- streaming: false,
51
- },
52
- });
53
-
54
- // End spans with results
55
- llmSpan.end({
56
- output: 'Generated response',
57
- attributes: { usage: { totalTokens: 180 } },
58
- });
59
- agentSpan.end();
7
+ ```bash
8
+ npm install @mastra/observability
60
9
  ```
61
10
 
62
- ### Span Types
63
-
64
- - **`WORKFLOW_RUN`**: Root span for entire workflow execution
65
- - **`WORKFLOW_STEP`**: Individual step execution within a workflow
66
- - **`AGENT_RUN`**: Agent processing (supports tools, memory, multi-step)
67
- - **`MODEL_GENERATION`**: Individual model API calls with token usage
68
- - **`TOOL_CALL`**: Function/tool execution
69
- - **`MCP_TOOL_CALL`**: Model Context Protocol tool execution
70
- - **`PROCESSOR_RUN`**: Input/output processor execution
71
- - **`GENERIC`**: Custom spans for other operations
72
-
73
- ### Basic Configuration
74
-
75
- Enable observability in your Mastra instance:
11
+ ## Quick Start
76
12
 
77
13
  ```typescript
78
14
  import { Mastra } from '@mastra/core';
79
- import { Observability } from '@mastra/observability';
15
+ import { Observability, DefaultExporter, CloudExporter, SensitiveDataFilter } from '@mastra/observability';
80
16
 
81
17
  export const mastra = new Mastra({
82
- // ... other config
83
18
  observability: new Observability({
84
- default: { enabled: true },
19
+ configs: {
20
+ default: {
21
+ serviceName: 'my-app',
22
+ exporters: [
23
+ new DefaultExporter(), // Persists traces for Mastra Studio
24
+ new CloudExporter(), // Sends to Mastra Cloud
25
+ ],
26
+ spanOutputProcessors: [new SensitiveDataFilter()],
27
+ },
28
+ },
85
29
  }),
86
30
  });
87
31
  ```
88
32
 
89
- This enables the `DefaultExporter` and `CloudExporter`, with the `SensitiveDataFilter` span output processor, and `always` sampling.
33
+ ## Features
34
+
35
+ - **Auto-instrumentation** - Traces agent runs, LLM calls, tool executions, and workflows
36
+ - **Pluggable Exporters** - Exporters for Studio and Cloud, plus integrations for Arize, Braintrust, Langfuse, LangSmith, and OpenTelemetry
37
+ - **Sampling Strategies** - Always, ratio-based, or custom sampling
38
+ - **Span Processors** - Transform or filter span data before export
39
+ - **OpenTelemetry Compatible** - Standard trace/span ID formats for integration
90
40
 
91
- ## Performance Considerations
41
+ ## Span Types
92
42
 
93
- ### Current Implementation
43
+ - `WORKFLOW_RUN` - Workflow execution
44
+ - `WORKFLOW_STEP` - Individual workflow step
45
+ - `AGENT_RUN` - Agent processing
46
+ - `MODEL_GENERATION` - LLM API calls
47
+ - `TOOL_CALL` - Tool execution
48
+ - `MCP_TOOL_CALL` - MCP tool execution
49
+ - `PROCESSOR_RUN` - Processor execution
50
+ - `GENERIC` - Custom operations
94
51
 
95
- The current implementation prioritizes correctness and ease of use:
52
+ ## Documentation
96
53
 
97
- - **Automatic Lifecycle Management**: All spans automatically emit events through method wrapping
98
- - **Real-time Export**: Events are exported immediately when they occur
99
- - **Memory Overhead**: Each span maintains references to tracing instance
54
+ For configuration options, exporters, sampling strategies, and more, see the [full documentation](https://mastra.ai/docs/v1/observability/overview).