@mastra/mcp-docs-server 1.1.35-alpha.6 → 1.1.35
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/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
- package/.docs/docs/agents/background-tasks.md +62 -2
- package/.docs/docs/agents/processors.md +9 -1
- package/.docs/docs/agents/response-caching.md +148 -0
- package/.docs/docs/agents/signals.md +151 -0
- package/.docs/docs/agents/using-tools.md +8 -0
- package/.docs/docs/browser/agent-browser.md +15 -0
- package/.docs/docs/browser/stagehand.md +25 -1
- package/.docs/docs/editor/tools.md +1 -1
- package/.docs/docs/index.md +2 -2
- package/.docs/docs/mastra-platform/configuration.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/memory/observational-memory.md +61 -13
- package/.docs/docs/memory/semantic-recall.md +68 -6
- package/.docs/docs/observability/logging.md +2 -2
- package/.docs/docs/observability/metrics/overview.md +4 -4
- package/.docs/docs/observability/overview.md +6 -6
- package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
- package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
- package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +28 -26
- package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
- package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
- package/.docs/docs/observability/tracing/overview.md +30 -29
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/docs/server/mastra-server.md +30 -19
- package/.docs/docs/studio/observability.md +4 -4
- package/.docs/docs/studio/overview.md +6 -0
- package/.docs/docs/voice/overview.md +84 -0
- package/.docs/docs/workflows/suspend-and-resume.md +28 -1
- package/.docs/guides/deployment/inngest.md +23 -0
- package/.docs/guides/guide/web-search.md +7 -7
- package/.docs/guides/migrations/mastra-cloud.md +6 -6
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
- package/.docs/models/gateways/azure-openai.md +94 -23
- package/.docs/models/gateways/netlify.md +2 -1
- package/.docs/models/gateways/openrouter.md +4 -1
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/chutes.md +23 -54
- package/.docs/models/providers/databricks.md +96 -0
- package/.docs/models/providers/deepseek.md +3 -1
- package/.docs/models/providers/digitalocean.md +9 -2
- package/.docs/models/providers/firepass.md +71 -0
- package/.docs/models/providers/google.md +3 -2
- package/.docs/models/providers/kilo.md +5 -3
- package/.docs/models/providers/llmgateway.md +7 -1
- package/.docs/models/providers/nebius.md +37 -55
- package/.docs/models/providers/novita-ai.md +5 -5
- package/.docs/models/providers/nvidia.md +59 -49
- package/.docs/models/providers/ollama-cloud.md +1 -1
- package/.docs/models/providers/openai.md +2 -0
- package/.docs/models/providers/opencode.md +44 -43
- package/.docs/models/providers/poe.md +4 -1
- package/.docs/models/providers/sarvam.md +72 -0
- package/.docs/models/providers/wafer.ai.md +2 -1
- package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
- package/.docs/models/providers.md +3 -1
- package/.docs/reference/agents/agent.md +85 -0
- package/.docs/reference/browser/agent-browser.md +37 -11
- package/.docs/reference/browser/stagehand-browser.md +35 -9
- package/.docs/reference/cli/mastra.md +497 -1
- package/.docs/reference/client-js/agents.md +115 -1
- package/.docs/reference/client-js/responses.md +4 -0
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/editor/tool-provider.md +3 -3
- package/.docs/reference/harness/harness-class.md +21 -8
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/memory/observational-memory.md +11 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
- package/.docs/reference/observability/tracing/configuration.md +6 -3
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -1
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
- package/.docs/reference/observability/tracing/instances.md +2 -2
- package/.docs/reference/observability/tracing/interfaces.md +37 -2
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
- package/.docs/reference/observability/tracing/span-filtering.md +2 -2
- package/.docs/reference/processors/prefill-error-handler.md +3 -3
- package/.docs/reference/processors/response-cache.md +114 -0
- package/.docs/reference/processors/tool-call-filter.md +28 -0
- package/.docs/reference/storage/clickhouse.md +8 -8
- package/.docs/reference/storage/cloudflare-d1.md +1 -1
- package/.docs/reference/storage/cloudflare.md +1 -1
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +1 -1
- package/.docs/reference/storage/dsql.md +428 -0
- package/.docs/reference/storage/duckdb.md +3 -3
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +44 -0
- package/.docs/reference/streaming/agents/stream.md +18 -2
- package/.docs/reference/tools/brightdata.md +167 -0
- package/.docs/reference/tools/create-tool.md +46 -0
- package/.docs/reference/voice/inworld.md +133 -0
- package/.docs/reference/workflows/workflow-state-reader.md +113 -0
- package/CHANGELOG.md +113 -0
- package/package.json +6 -6
|
@@ -14,7 +14,7 @@ Tool providers implement these methods:
|
|
|
14
14
|
|
|
15
15
|
**getToolSchema(slug)** (`(slug: string) => Promise<JSONSchema>`): Returns the JSON schema for a specific tool identified by its slug.
|
|
16
16
|
|
|
17
|
-
**resolveTools(slugs, options?)** (`(slugs: string[], options?) => Promise<Record<string, ToolAction>>`): Resolves tool slugs into executable Mastra tool actions.
|
|
17
|
+
**resolveTools(slugs, options?)** (`(slugs: string[], options?) => Promise<Record<string, ToolAction>>`): Resolves tool slugs into executable Mastra tool actions. Built-in providers use resourceId from request context for per-user authentication.
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -47,7 +47,7 @@ Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MES
|
|
|
47
47
|
|
|
48
48
|
### Authentication
|
|
49
49
|
|
|
50
|
-
Tool execution is scoped to
|
|
50
|
+
Tool execution is scoped to the `resourceId` passed through request context. The provider maps that value to the user identity required by Composio's auth flow.
|
|
51
51
|
|
|
52
52
|
***
|
|
53
53
|
|
|
@@ -82,4 +82,4 @@ Arcade tools use `Toolkit.ToolName` format: `Github.GetRepository`, `Slack.SendM
|
|
|
82
82
|
|
|
83
83
|
### Authentication
|
|
84
84
|
|
|
85
|
-
Like Composio, tool execution
|
|
85
|
+
Like Composio, tool execution uses `resourceId` from request context for per-user authorization. The provider maps that value to the user identity required by Arcade's auth flow.
|
|
@@ -98,7 +98,7 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
98
98
|
|
|
99
99
|
**omConfig** (`HarnessOMConfig`): Default configuration for observational memory (observer/reflector model IDs and thresholds).
|
|
100
100
|
|
|
101
|
-
**disableBuiltinTools** (`BuiltinToolId[]`): Built-in harness tool IDs to remove from the \`harnessBuiltIn\` toolset. Valid values are \`ask\_user\`, \`submit\_plan\`, \`task\_write\`, \`task\_check\`, and \`subagent\`.
|
|
101
|
+
**disableBuiltinTools** (`BuiltinToolId[]`): Built-in harness tool IDs to remove from the \`harnessBuiltIn\` toolset. Valid values are \`ask\_user\`, \`submit\_plan\`, \`task\_write\`, \`task\_update\`, \`task\_complete\`, \`task\_check\`, and \`subagent\`.
|
|
102
102
|
|
|
103
103
|
**heartbeatHandlers** (`HeartbeatHandler[]`): Periodic background tasks started during \`init()\`. Use for gateway sync, cache refresh, and similar tasks.
|
|
104
104
|
|
|
@@ -162,6 +162,17 @@ Return the current `HarnessDisplayState` snapshot for UI rendering.
|
|
|
162
162
|
const displayState = harness.getDisplayState()
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
#### `restoreDisplayTasks(tasks)`
|
|
166
|
+
|
|
167
|
+
Restore the task portion of `HarnessDisplayState` after a UI replays persisted task tool history. This emits `display_state_changed` without emitting a live `task_updated` event.
|
|
168
|
+
|
|
169
|
+
If later task tools should read the replayed tasks, persist the same task list with `setState({ tasks })` before calling `restoreDisplayTasks(tasks)`.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
await harness.setState({ tasks: replayedTasks })
|
|
173
|
+
harness.restoreDisplayTasks(replayedTasks)
|
|
174
|
+
```
|
|
175
|
+
|
|
165
176
|
#### `setState(updates)`
|
|
166
177
|
|
|
167
178
|
Update the harness state. Validates against `stateSchema` if provided, and emits a `state_changed` event with the new state and changed keys.
|
|
@@ -831,13 +842,15 @@ The harness emits events through registered listeners. The following table lists
|
|
|
831
842
|
|
|
832
843
|
The harness provides built-in tools to agents in every mode:
|
|
833
844
|
|
|
834
|
-
| Tool
|
|
835
|
-
|
|
|
836
|
-
| `ask_user`
|
|
837
|
-
| `submit_plan`
|
|
838
|
-
| `task_write`
|
|
839
|
-
| `
|
|
840
|
-
| `
|
|
845
|
+
| Tool | Description |
|
|
846
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
847
|
+
| `ask_user` | Ask the user a question and wait for their response. Supports free text, single-select choices, and multi-select choices. |
|
|
848
|
+
| `submit_plan` | Submit a plan for user review and approval. |
|
|
849
|
+
| `task_write` | Create or replace a structured task list for tracking progress. Assigns task IDs when omitted and returns the structured task list snapshot. |
|
|
850
|
+
| `task_update` | Update one tracked task by ID and return the structured task list snapshot. |
|
|
851
|
+
| `task_complete` | Mark one tracked task completed by ID and return the structured task list snapshot. |
|
|
852
|
+
| `task_check` | Check the completion status of the current task list and return `tasks`, `summary`, `incompleteTasks`, and `isError` fields. |
|
|
853
|
+
| `subagent` | Spawn a focused subagent with constrained tools (only available when `subagents` is configured). Pass `forked: true` to inherit the parent conversation — see [Forked subagents](#forked-subagents). |
|
|
841
854
|
|
|
842
855
|
### `ask_user` selections
|
|
843
856
|
|
package/.docs/reference/index.md
CHANGED
|
@@ -170,6 +170,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
170
170
|
- [PromptInjectionDetector](https://mastra.ai/reference/processors/prompt-injection-detector)
|
|
171
171
|
- [ProviderHistoryCompat](https://mastra.ai/reference/processors/provider-history-compat)
|
|
172
172
|
- [RegexFilterProcessor](https://mastra.ai/reference/processors/regex-filter-processor)
|
|
173
|
+
- [ResponseCache](https://mastra.ai/reference/processors/response-cache)
|
|
173
174
|
- [SemanticRecall](https://mastra.ai/reference/processors/semantic-recall-processor)
|
|
174
175
|
- [SkillSearchProcessor](https://mastra.ai/reference/processors/skill-search-processor)
|
|
175
176
|
- [StreamErrorRetryProcessor](https://mastra.ai/reference/processors/stream-error-retry-processor)
|
|
@@ -198,6 +199,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
198
199
|
- [registerApiRoute()](https://mastra.ai/reference/server/register-api-route)
|
|
199
200
|
- [Server Routes](https://mastra.ai/reference/server/routes)
|
|
200
201
|
- [Overview](https://mastra.ai/reference/storage/overview)
|
|
202
|
+
- [Aurora DSQL Storage](https://mastra.ai/reference/storage/dsql)
|
|
201
203
|
- [ClickHouse Storage](https://mastra.ai/reference/storage/clickhouse)
|
|
202
204
|
- [Cloudflare D1 Storage](https://mastra.ai/reference/storage/cloudflare-d1)
|
|
203
205
|
- [Cloudflare KV Storage](https://mastra.ai/reference/storage/cloudflare)
|
|
@@ -222,6 +224,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
222
224
|
- [.stream()](https://mastra.ai/reference/streaming/workflows/stream)
|
|
223
225
|
- [.timeTravelStream()](https://mastra.ai/reference/streaming/workflows/timeTravelStream)
|
|
224
226
|
- [Overview](https://mastra.ai/reference/templates/overview)
|
|
227
|
+
- [Bright Data Tools](https://mastra.ai/reference/tools/brightdata)
|
|
225
228
|
- [createDocumentChunkerTool()](https://mastra.ai/reference/tools/document-chunker-tool)
|
|
226
229
|
- [createGraphRAGTool()](https://mastra.ai/reference/tools/graph-rag-tool)
|
|
227
230
|
- [createTool()](https://mastra.ai/reference/tools/create-tool)
|
|
@@ -256,6 +259,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
256
259
|
- [Events](https://mastra.ai/reference/voice/voice.events)
|
|
257
260
|
- [Google](https://mastra.ai/reference/voice/google)
|
|
258
261
|
- [Google Gemini Live](https://mastra.ai/reference/voice/google-gemini-live)
|
|
262
|
+
- [Inworld](https://mastra.ai/reference/voice/inworld)
|
|
259
263
|
- [Mastra Voice](https://mastra.ai/reference/voice/mastra-voice)
|
|
260
264
|
- [Murf](https://mastra.ai/reference/voice/murf)
|
|
261
265
|
- [OpenAI](https://mastra.ai/reference/voice/openai)
|
|
@@ -278,6 +282,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
278
282
|
- [Run Class](https://mastra.ai/reference/workflows/run)
|
|
279
283
|
- [Step Class](https://mastra.ai/reference/workflows/step)
|
|
280
284
|
- [Workflow Class](https://mastra.ai/reference/workflows/workflow)
|
|
285
|
+
- [Workflow State Reader](https://mastra.ai/reference/workflows/workflow-state-reader)
|
|
281
286
|
- [.branch()](https://mastra.ai/reference/workflows/workflow-methods/branch)
|
|
282
287
|
- [.commit()](https://mastra.ai/reference/workflows/workflow-methods/commit)
|
|
283
288
|
- [.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|
|
@@ -36,7 +36,9 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
36
36
|
|
|
37
37
|
**scope** (`'resource' | 'thread'`): Memory scope for observations. \`'thread'\` keeps observations per-thread. \`'resource'\` (experimental) shares observations across all threads for a resource, enabling cross-conversation memory. (Default: `'thread'`)
|
|
38
38
|
|
|
39
|
-
**activateAfterIdle** (`number | string`): Time before buffered observations
|
|
39
|
+
**activateAfterIdle** (`number | string | false`): Time before buffered observations are forced to activate after inactivity, even before \`observation.messageTokens\` is reached. Accepts a numeric millisecond value such as \`300\_000\`, duration strings like \`"5m"\` or \`"1hr"\`, or \`false\` to disable inherited observation idle activation. Reflections do not inherit this setting. Use \`reflection.activateAfterIdle\` to opt reflections into idle activation.
|
|
40
|
+
|
|
41
|
+
**activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. Reflections do not inherit this setting. Use \`reflection.activateOnProviderChange\` to opt reflections into provider-change activation. (Default: `false`)
|
|
40
42
|
|
|
41
43
|
**shareTokenBudget** (`boolean`): Share the token budget between messages and observations. When enabled, the total budget is \`observation.messageTokens + reflection.observationTokens\`. Messages can use more space when observations are small, and vice versa. This maximizes context usage through flexible allocation. \`shareTokenBudget\` is not yet compatible with async buffering. You must set \`observation: { bufferTokens: false }\` when using this option (this is a temporary limitation). (Default: `false`)
|
|
42
44
|
|
|
@@ -66,6 +68,10 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
66
68
|
|
|
67
69
|
**observation.bufferActivation** (`number`): Controls how much of the message window to retain after activation. Accepts a ratio (0-1) or an absolute token count (≥ 1000). For example, \`0.8\` means: activate enough buffers to remove 80% of \`messageTokens\` and leave 20% as active message history. An absolute token count like \`4000\` targets a goal of keeping \~4k message tokens remaining after activation. Higher values remove more message history per activation when using a ratio. Higher values keep more message history when using a token count.
|
|
68
70
|
|
|
71
|
+
**observation.activateAfterIdle** (`number | string | false`): Time before buffered observations are forced to activate after inactivity. Accepts milliseconds, a duration string, or \`false\`. If unset, the top-level \`activateAfterIdle\` value is used for observations. Set \`false\` to disable the top-level idle setting for observations.
|
|
72
|
+
|
|
73
|
+
**observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level \`activateOnProviderChange\` value is used for observations.
|
|
74
|
+
|
|
69
75
|
**observation.blockAfter** (`number`): Token threshold above which synchronous (blocking) observation is forced. Between \`messageTokens\` and \`blockAfter\`, only async buffering/activation is used. Above \`blockAfter\`, a synchronous observation runs as a last resort, while buffered activation still preserves a minimum remaining context (min(1000, retention floor)). Accepts a multiplier (1 < value < 2, multiplied by \`messageTokens\`) or an absolute token count (≥ 2, must be greater than \`messageTokens\`). Only relevant when \`bufferTokens\` is set. Defaults to \`1.2\` when async buffering is enabled.
|
|
70
76
|
|
|
71
77
|
**observation.previousObserverTokens** (`number | false`): Optional token budget for the observer's previous-observations context. When set to a number, the observations passed to the Observer agent are tail-truncated to fit within this budget while keeping the newest observations and preserving highlighted 🔴 items when possible. When a buffered reflection is pending, the already-reflected observation lines are automatically replaced with the reflection summary before truncation. Set to \`0\` to omit previous observations entirely, or \`false\` to disable truncation explicitly.
|
|
@@ -86,6 +92,10 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
86
92
|
|
|
87
93
|
**reflection.bufferActivation** (`number`): Ratio (0-1) controlling when async reflection buffering starts. When observation tokens reach \`observationTokens \* bufferActivation\`, reflection runs in the background. On activation at the full threshold, the buffered reflection replaces the observations it covers, preserving any new observations appended after that range.
|
|
88
94
|
|
|
95
|
+
**reflection.activateAfterIdle** (`number | string | false`): Time before buffered reflections are forced to activate after inactivity. Accepts milliseconds, a duration string, or \`false\`. Reflections do not inherit top-level \`activateAfterIdle\`; set this explicitly to opt reflections into idle activation.
|
|
96
|
+
|
|
97
|
+
**reflection.activateOnProviderChange** (`boolean`): Force buffered reflections to activate when the actor provider or model changes. Reflections do not inherit top-level \`activateOnProviderChange\`; set this explicitly to opt reflections into provider-change activation.
|
|
98
|
+
|
|
89
99
|
**reflection.blockAfter** (`number`): Token threshold above which synchronous (blocking) reflection is forced. Between \`observationTokens\` and \`blockAfter\`, only async buffering/activation is used. Above \`blockAfter\`, a synchronous reflection runs as a last resort. Accepts a multiplier (1 < value < 2, multiplied by \`observationTokens\`) or an absolute token count (≥ 2, must be greater than \`observationTokens\`). Only relevant when \`bufferActivation\` is set. Defaults to \`1.2\` when async reflection is enabled.
|
|
90
100
|
|
|
91
101
|
### Token estimate metadata cache
|
|
@@ -8,13 +8,11 @@ For setup instructions, see the [Metrics overview](https://mastra.ai/docs/observ
|
|
|
8
8
|
|
|
9
9
|
Metrics are extracted from spans when they end. The observability layer inspects each completed span, calculates duration, and (for model generation spans) reads token usage data. No manual instrumentation is needed.
|
|
10
10
|
|
|
11
|
-
Metrics are routed through an internal event bus to the `DefaultExporter`, which batches and flushes them to storage.
|
|
12
|
-
|
|
13
11
|
### What affects whether a metric is available
|
|
14
12
|
|
|
15
13
|
Two conditions must be true for a metric to reach storage:
|
|
16
14
|
|
|
17
|
-
1. `
|
|
15
|
+
1. `MastraStorageExporter` is configured as an exporter.
|
|
18
16
|
2. The storage backend supports metrics (ClickHouse or DuckDB).
|
|
19
17
|
|
|
20
18
|
If metrics aren't appearing, see [troubleshooting](#troubleshooting).
|
|
@@ -117,7 +115,7 @@ When you spot a spike in latency or token usage on the Metrics dashboard, correl
|
|
|
117
115
|
### No metrics are appearing
|
|
118
116
|
|
|
119
117
|
- **Observability is configured**: Verify that your `Mastra` instance has an `observability` config with at least one exporter.
|
|
120
|
-
- **`
|
|
118
|
+
- **`MastraStorageExporter` or `MastraPlatformExporter` is present**: Other exporters (Datadog, Langfuse, etc.) don't surface metrics in Mastra. `MastraStorageExporter` is required for the local Studio dashboard, and `MastraPlatformExporter` is required to view metrics in Mastra Platform.
|
|
121
119
|
- **Storage supports metrics**: Metrics require an OLAP-capable store (ClickHouse or DuckDB). Row-oriented databases (PostgreSQL, LibSQL, MSSQL) and document stores (MongoDB) are not supported for metrics.
|
|
122
120
|
- **Sampling isn't 0%**: If sampling probability is `0` or strategy is `never`, all spans become no-ops and no metrics are extracted.
|
|
123
121
|
|
|
@@ -129,7 +129,7 @@ The bridge can be combined with non-Datadog exporters to send traces to addition
|
|
|
129
129
|
|
|
130
130
|
```typescript
|
|
131
131
|
import { Mastra } from '@mastra/core'
|
|
132
|
-
import { Observability,
|
|
132
|
+
import { Observability, MastraStorageExporter } from '@mastra/observability'
|
|
133
133
|
import { DatadogBridge } from '@mastra/datadog'
|
|
134
134
|
|
|
135
135
|
const mastra = new Mastra({
|
|
@@ -141,7 +141,7 @@ const mastra = new Mastra({
|
|
|
141
141
|
mlApp: process.env.DD_LLMOBS_ML_APP!,
|
|
142
142
|
}),
|
|
143
143
|
exporters: [
|
|
144
|
-
new
|
|
144
|
+
new MastraStorageExporter(), // Studio access
|
|
145
145
|
],
|
|
146
146
|
},
|
|
147
147
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Warning:** The OpenTelemetry Bridge is currently **experimental**. APIs and configuration options may change in future releases.
|
|
4
4
|
|
|
5
|
-
Enables bidirectional integration between Mastra tracing and OpenTelemetry infrastructure. Creates native OTEL spans for Mastra operations and inherits context from active OTEL spans.
|
|
5
|
+
Enables bidirectional integration between Mastra tracing and OpenTelemetry infrastructure. Creates native OTEL spans for Mastra operations and inherits context from active OTEL spans. Also forwards Mastra log events to the globally-registered OTEL `LoggerProvider`, emitting each log under the OTEL context of the originating Mastra span so trace-log correlation works automatically.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -32,7 +32,29 @@ Executes a synchronous function within the OTEL context of a Mastra span.
|
|
|
32
32
|
|
|
33
33
|
**Returns:** `T` - The result of the function execution.
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### `onLogEvent`
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
async onLogEvent(event: LogEvent): Promise<void>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Forwards a Mastra log event to the globally-registered OTEL `LoggerProvider`. Trace correlation is resolved in this order:
|
|
42
|
+
|
|
43
|
+
1. If the log carries a `spanId` the bridge has an OTEL span for, the log is emitted under that span's stored OTEL context.
|
|
44
|
+
2. Otherwise, if the log carries `traceId` and `spanId`, those IDs are attached to the emitted log record's `SpanContext`.
|
|
45
|
+
3. Otherwise, the log is emitted under whatever OTEL context is currently active.
|
|
46
|
+
|
|
47
|
+
If no `LoggerProvider` is registered globally, emission is a silent no-op.
|
|
48
|
+
|
|
49
|
+
### `flush`
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
async flush(): Promise<void>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Force flushes the global OTEL tracer provider and logger provider if they support `forceFlush`. Useful in serverless environments where you need to drain telemetry before the runtime terminates.
|
|
56
|
+
|
|
57
|
+
### `shutdown`
|
|
36
58
|
|
|
37
59
|
```typescript
|
|
38
60
|
async shutdown(): Promise<void>
|
|
@@ -68,7 +90,7 @@ The bridge can be used alongside exporters. The bridge handles OTEL context, whi
|
|
|
68
90
|
|
|
69
91
|
```typescript
|
|
70
92
|
import { Mastra } from '@mastra/core'
|
|
71
|
-
import { Observability,
|
|
93
|
+
import { Observability, MastraStorageExporter } from '@mastra/observability'
|
|
72
94
|
import { OtelBridge } from '@mastra/otel-bridge'
|
|
73
95
|
import { LangfuseExporter } from '@mastra/langfuse'
|
|
74
96
|
|
|
@@ -79,7 +101,7 @@ const mastra = new Mastra({
|
|
|
79
101
|
serviceName: 'my-service',
|
|
80
102
|
bridge: new OtelBridge(), // Handles OTEL context
|
|
81
103
|
exporters: [
|
|
82
|
-
new
|
|
104
|
+
new MastraStorageExporter(), // Studio access
|
|
83
105
|
new LangfuseExporter({
|
|
84
106
|
// Additional destination
|
|
85
107
|
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
|
|
@@ -7,15 +7,18 @@ interface ObservabilityRegistryConfig {
|
|
|
7
7
|
default?: { enabled?: boolean }
|
|
8
8
|
configs?: Record<string, Omit<ObservabilityInstanceConfig, 'name'> | ObservabilityInstance>
|
|
9
9
|
configSelector?: ConfigSelector
|
|
10
|
+
sensitiveDataFilter?: boolean | SensitiveDataFilterOptions
|
|
10
11
|
}
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
**default** (`{ enabled?: boolean }`): Enable default configuration with
|
|
14
|
+
**default** (`{ enabled?: boolean }`): Enable default configuration with MastraStorageExporter and MastraPlatformExporter
|
|
14
15
|
|
|
15
16
|
**configs** (`Record<string, Omit<ObservabilityInstanceConfig, 'name'> | ObservabilityInstance>`): Named observability instance configurations or pre-instantiated instances
|
|
16
17
|
|
|
17
18
|
**configSelector** (`ConfigSelector`): Runtime configuration selector function
|
|
18
19
|
|
|
20
|
+
**sensitiveDataFilter** (`boolean | SensitiveDataFilterOptions`): Controls whether a \[SensitiveDataFilter]\(/reference/observability/tracing/processors/sensitive-data-filter) is auto-applied to every configured instance. Defaults to \`true\`. Pass \`false\` to opt out, or pass a \`SensitiveDataFilterOptions\` object to customize fields, redaction token, or redaction style. If a config already includes a \`SensitiveDataFilter\` in \`spanOutputProcessors\`, it is not duplicated. Pre-instantiated instances are not modified.
|
|
21
|
+
|
|
19
22
|
## `ObservabilityInstanceConfig`
|
|
20
23
|
|
|
21
24
|
```typescript
|
|
@@ -201,8 +204,8 @@ Shuts down all observability instances and clears the registry.
|
|
|
201
204
|
|
|
202
205
|
### Exporters
|
|
203
206
|
|
|
204
|
-
- [
|
|
205
|
-
- [
|
|
207
|
+
- [MastraStorageExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter): Persists observability events to Mastra Storage
|
|
208
|
+
- [MastraPlatformExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter): Sends observability events to Mastra Platform
|
|
206
209
|
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust): Braintrust integration
|
|
207
210
|
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse): Langfuse integration
|
|
208
211
|
- [LangSmith](https://mastra.ai/reference/observability/tracing/exporters/langsmith): LangSmith integration
|
|
@@ -77,7 +77,7 @@ Flushes pending data and shuts down the client.
|
|
|
77
77
|
```typescript
|
|
78
78
|
import { ArizeExporter } from '@mastra/arize'
|
|
79
79
|
|
|
80
|
-
// For Phoenix: Set
|
|
80
|
+
// For Phoenix: Set PHOENIX_COLLECTOR_ENDPOINT, PHOENIX_API_KEY, PHOENIX_PROJECT_NAME
|
|
81
81
|
// For Arize AX: Set ARIZE_SPACE_ID, ARIZE_API_KEY, ARIZE_PROJECT_NAME
|
|
82
82
|
const exporter = new ArizeExporter()
|
|
83
83
|
```
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# CloudExporter
|
|
2
2
|
|
|
3
|
-
**Added in:** `@mastra/observability@1.8.0`
|
|
3
|
+
**Added in:** `@mastra/observability@1.8.0`. **Deprecated in `1.12.0`** in favor of [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter).
|
|
4
|
+
|
|
5
|
+
> **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. The two classes share the same constructor, environment variables, and runtime behavior; `CloudExporter` keeps its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs so monitoring rules built against it keep working.
|
|
4
6
|
|
|
5
7
|
Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
|
|
6
8
|
|
|
@@ -124,8 +124,8 @@ const exporterWithLogger = new ConsoleExporter({
|
|
|
124
124
|
|
|
125
125
|
### Other Exporters
|
|
126
126
|
|
|
127
|
-
- [
|
|
128
|
-
- [
|
|
127
|
+
- [MastraStorageExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter): Storage persistence
|
|
128
|
+
- [MastraPlatformExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter): Mastra platform
|
|
129
129
|
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse): Langfuse integration
|
|
130
130
|
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust): Braintrust integration
|
|
131
131
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# DefaultExporter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Deprecated in `@mastra/observability@1.12.0`** in favor of [`MastraStorageExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter).
|
|
4
|
+
|
|
5
|
+
> **Deprecated:** `DefaultExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraStorageExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter) for new projects. The two classes share the same constructor, configuration, and runtime behavior; `DefaultExporter` keeps its original `mastra-default-observability-exporter` exporter `name` so monitoring rules built against it keep working.
|
|
6
|
+
|
|
7
|
+
Persists observability events to Mastra Storage with automatic batching and retry logic.
|
|
4
8
|
|
|
5
9
|
## Constructor
|
|
6
10
|
|
|
@@ -128,6 +132,8 @@ Failed flushes are retried with exponential backoff:
|
|
|
128
132
|
- Maximum attempts: `maxRetries`
|
|
129
133
|
- Batch is dropped after all retries fail
|
|
130
134
|
|
|
135
|
+
When storage does not support a signal or retries are exhausted, `DefaultExporter` emits an `ObservabilityDropEvent` through `onDroppedEvent` handlers registered on exporters and bridges. The drop event includes the signal, reason, count, exporter name, storage name when known, and sanitized error details.
|
|
136
|
+
|
|
131
137
|
### Out-of-Order Handling
|
|
132
138
|
|
|
133
139
|
For `batch-with-updates` strategy:
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# MastraPlatformExporter
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/observability@1.12.0`. Earlier releases (`@mastra/observability@1.8.0` through `1.11.x`) export the same exporter as the deprecated `CloudExporter`.
|
|
4
|
+
|
|
5
|
+
Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
|
|
6
|
+
|
|
7
|
+
> **Note:** `MastraPlatformExporter` was previously called `CloudExporter`. The original `CloudExporter` class is still exported from `@mastra/observability` so existing imports keep working, but it is deprecated and will be removed in a future major version. New code should use `MastraPlatformExporter`.
|
|
8
|
+
|
|
9
|
+
## Constructor
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
new MastraPlatformExporter(config?: MastraPlatformExporterConfig)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## `MastraPlatformExporterConfig`
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
interface MastraPlatformExporterConfig extends BaseExporterConfig {
|
|
19
|
+
/** Maximum number of buffered events per batch (spans, logs, metrics, scores, feedback). Default: 1000 */
|
|
20
|
+
maxBatchSize?: number
|
|
21
|
+
|
|
22
|
+
/** Maximum wait time before flushing in milliseconds. Default: 5000 */
|
|
23
|
+
maxBatchWaitMs?: number
|
|
24
|
+
|
|
25
|
+
/** Maximum retry attempts. Default: 3 */
|
|
26
|
+
maxRetries?: number
|
|
27
|
+
|
|
28
|
+
/** Mastra Observability access token (from env or config) */
|
|
29
|
+
accessToken?: string
|
|
30
|
+
|
|
31
|
+
/** Project ID for project-scoped collector routes (letters, numbers, hyphens, underscores) */
|
|
32
|
+
projectId?: string
|
|
33
|
+
|
|
34
|
+
/** Base observability endpoint */
|
|
35
|
+
endpoint?: string
|
|
36
|
+
|
|
37
|
+
/** Explicit traces endpoint override */
|
|
38
|
+
tracesEndpoint?: string
|
|
39
|
+
|
|
40
|
+
/** Explicit logs endpoint override */
|
|
41
|
+
logsEndpoint?: string
|
|
42
|
+
|
|
43
|
+
/** Explicit metrics endpoint override */
|
|
44
|
+
metricsEndpoint?: string
|
|
45
|
+
|
|
46
|
+
/** Explicit scores endpoint override */
|
|
47
|
+
scoresEndpoint?: string
|
|
48
|
+
|
|
49
|
+
/** Explicit feedback endpoint override */
|
|
50
|
+
feedbackEndpoint?: string
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Extends `BaseExporterConfig`, which includes:
|
|
55
|
+
|
|
56
|
+
- `logger?: IMastraLogger` - Logger instance
|
|
57
|
+
- `logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error'` - Log level (default: INFO)
|
|
58
|
+
|
|
59
|
+
## Environment variables
|
|
60
|
+
|
|
61
|
+
The exporter reads these environment variables if not provided in config:
|
|
62
|
+
|
|
63
|
+
- `MASTRA_CLOUD_ACCESS_TOKEN` - Authentication token for `MastraPlatformExporter` requests
|
|
64
|
+
- `MASTRA_PROJECT_ID` - Project ID to use when deriving project-scoped collector routes such as `/projects/:projectId/ai/spans/publish`
|
|
65
|
+
- `MASTRA_CLOUD_TRACES_ENDPOINT` - Traces endpoint override. Pass either a base origin or a full traces publish URL. Defaults to `https://observability.mastra.ai` in `@mastra/observability@1.9.2` and later
|
|
66
|
+
|
|
67
|
+
## Properties
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
readonly name = 'mastra-platform-exporter';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The deprecated `CloudExporter` class continues to use `'mastra-cloud-observability-exporter'` as its `name` for backward compatibility.
|
|
74
|
+
|
|
75
|
+
## Methods
|
|
76
|
+
|
|
77
|
+
### `exportTracingEvent`
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
async exportTracingEvent(event: TracingEvent): Promise<void>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Processes tracing events for export to the Mastra platform.
|
|
84
|
+
|
|
85
|
+
Only `SPAN_ENDED` tracing events are exported. `SPAN_STARTED` and `SPAN_UPDATED` are ignored. Matching spans are buffered and uploaded to the traces endpoint on the next flush.
|
|
86
|
+
|
|
87
|
+
**Returns:** `Promise<void>` after the tracing event has been accepted for buffering or ignored.
|
|
88
|
+
|
|
89
|
+
### `onLogEvent`
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
async onLogEvent(event: LogEvent): Promise<void>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Processes log signals for export.
|
|
96
|
+
|
|
97
|
+
Every `LogEvent` passed to this handler is buffered and exported to the logs endpoint derived from the configured base endpoint. Unlike tracing, there is no additional event-status filtering at the `MastraPlatformExporter` level. If the exporter is disabled, this method becomes a no-op.
|
|
98
|
+
|
|
99
|
+
**Returns:** `Promise<void>` after the log event has been accepted for buffering.
|
|
100
|
+
|
|
101
|
+
### `onMetricEvent`
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
async onMetricEvent(event: MetricEvent): Promise<void>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Processes metric signals for export.
|
|
108
|
+
|
|
109
|
+
Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint. There is no additional filtering by metric subtype or status inside `MastraPlatformExporter`; the exporter forwards every metric event it receives unless it is disabled.
|
|
110
|
+
|
|
111
|
+
**Returns:** `Promise<void>` after the metric event has been accepted for buffering.
|
|
112
|
+
|
|
113
|
+
### `onScoreEvent`
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
async onScoreEvent(event: ScoreEvent): Promise<void>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Processes score signals for export.
|
|
120
|
+
|
|
121
|
+
Every `ScoreEvent` passed to this handler is buffered and exported to the scores endpoint derived from the configured base endpoint. There is no extra filtering at the exporter layer beyond the disabled-exporter check, so all score events received by this method are forwarded.
|
|
122
|
+
|
|
123
|
+
**Returns:** `Promise<void>` after the score event has been accepted for buffering.
|
|
124
|
+
|
|
125
|
+
### `onFeedbackEvent`
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
async onFeedbackEvent(event: FeedbackEvent): Promise<void>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Processes feedback signals for export.
|
|
132
|
+
|
|
133
|
+
Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint. There is no feedback-type filtering inside `MastraPlatformExporter`; all feedback events received here are forwarded unless the exporter is disabled.
|
|
134
|
+
|
|
135
|
+
**Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
|
|
136
|
+
|
|
137
|
+
### flush
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
async flush(): Promise<void>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Force flushes any buffered events to the Mastra platform without shutting down the exporter. Useful in serverless environments where you need to ensure spans are exported before the runtime terminates.
|
|
144
|
+
|
|
145
|
+
### shutdown
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
async shutdown(): Promise<void>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Flushes remaining events and performs cleanup.
|
|
152
|
+
|
|
153
|
+
## Behavior
|
|
154
|
+
|
|
155
|
+
### Authentication
|
|
156
|
+
|
|
157
|
+
If no access token is provided via config or environment variable, the exporter:
|
|
158
|
+
|
|
159
|
+
- Logs a warning with sign-up information
|
|
160
|
+
- Operates as a no-op (discards all events)
|
|
161
|
+
|
|
162
|
+
### Batching
|
|
163
|
+
|
|
164
|
+
The exporter batches tracing spans, logs, metrics, scores, and feedback for efficient network usage:
|
|
165
|
+
|
|
166
|
+
- Flushes when total buffered event count reaches `maxBatchSize`
|
|
167
|
+
- Flushes when `maxBatchWaitMs` elapsed since the first buffered signal in the batch
|
|
168
|
+
- Flushes on `shutdown()`
|
|
169
|
+
|
|
170
|
+
### Error handling
|
|
171
|
+
|
|
172
|
+
- Uses exponential backoff retry with `maxRetries` attempts
|
|
173
|
+
- Drops batches after all retries fail
|
|
174
|
+
- Logs errors but continues processing new events
|
|
175
|
+
|
|
176
|
+
Errors raised by `MastraPlatformExporter` use the `MASTRA_PLATFORM_EXPORTER_*` `id` prefix. The deprecated `CloudExporter` continues to emit `CLOUD_EXPORTER_*` `id`s.
|
|
177
|
+
|
|
178
|
+
### Endpoint routing
|
|
179
|
+
|
|
180
|
+
- Base origins derive signal endpoints automatically
|
|
181
|
+
- Without `projectId`, derived routes use `/ai/{signal}/publish`
|
|
182
|
+
- With `projectId` or `MASTRA_PROJECT_ID`, derived routes use `/projects/:projectId/ai/{signal}/publish`
|
|
183
|
+
- Explicit full publish URLs are used as-is, even when `projectId` is configured
|
|
184
|
+
|
|
185
|
+
### Signal Processing
|
|
186
|
+
|
|
187
|
+
- `exportTracingEvent()` only exports `SPAN_ENDED` tracing events
|
|
188
|
+
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for their respective signal type
|
|
189
|
+
- All supported signal batches are uploaded to their matching publish endpoints during `flush()` and `shutdown()`
|
|
190
|
+
|
|
191
|
+
## Span wire format
|
|
192
|
+
|
|
193
|
+
The shape of each span sent to Mastra Platform is documented here for reference only — it is not exported from `@mastra/observability` and should not be imported. The exporter spreads the original `AnyExportedSpan` (so the source field names are preserved) and layers a small set of platform-friendly aliases on top:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
type MastraPlatformSpanRecord = AnyExportedSpan & {
|
|
197
|
+
// Aliases derived from the source span
|
|
198
|
+
spanId: string // alias for span.id
|
|
199
|
+
spanType: string // alias for span.type
|
|
200
|
+
startedAt: Date // alias for span.startTime
|
|
201
|
+
endedAt: Date | null // alias for span.endTime ?? null
|
|
202
|
+
error: AnyExportedSpan['errorInfo'] | null
|
|
203
|
+
|
|
204
|
+
// Stamped at export time
|
|
205
|
+
createdAt: Date
|
|
206
|
+
updatedAt: Date | null
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The spread `AnyExportedSpan` also carries the original `id`, `type`, `name`, `traceId`, `parentSpanId`, `isRootSpan`, `isEvent`, `startTime`, `endTime`, `entityType`, `entityId`, `entityName`, `tags`, `attributes`, `metadata`, `input`, `output`, and `errorInfo`. See [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces) for `AnyExportedSpan`.
|
|
211
|
+
|
|
212
|
+
## Usage
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { MastraPlatformExporter } from '@mastra/observability'
|
|
216
|
+
|
|
217
|
+
// Uses environment variable for token
|
|
218
|
+
const exporter = new MastraPlatformExporter()
|
|
219
|
+
|
|
220
|
+
// Explicit configuration
|
|
221
|
+
const customExporter = new MastraPlatformExporter({
|
|
222
|
+
accessToken: 'your-token',
|
|
223
|
+
projectId: 'project_123',
|
|
224
|
+
maxBatchSize: 500,
|
|
225
|
+
maxBatchWaitMs: 2000,
|
|
226
|
+
logLevel: 'debug',
|
|
227
|
+
})
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Migrating from `CloudExporter`
|
|
231
|
+
|
|
232
|
+
The two classes share the same constructor signature, environment variables, and behavior. To migrate, replace the import and constructor:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// Before
|
|
236
|
+
import { CloudExporter } from '@mastra/observability'
|
|
237
|
+
const exporter = new CloudExporter()
|
|
238
|
+
|
|
239
|
+
// After
|
|
240
|
+
import { MastraPlatformExporter } from '@mastra/observability'
|
|
241
|
+
const exporter = new MastraPlatformExporter()
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The original `CloudExporter` is preserved unchanged so dashboards or alert rules that match the previous `CLOUD_EXPORTER_*` error IDs or `mastra-cloud-observability-exporter` exporter name keep working until you migrate.
|
|
245
|
+
|
|
246
|
+
## See also
|
|
247
|
+
|
|
248
|
+
### Documentation
|
|
249
|
+
|
|
250
|
+
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview): Complete guide
|
|
251
|
+
- [Exporters](https://mastra.ai/docs/observability/tracing/overview): Exporter concepts
|
|
252
|
+
|
|
253
|
+
### Other Exporters
|
|
254
|
+
|
|
255
|
+
- [MastraStorageExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter): Storage persistence
|
|
256
|
+
- [ConsoleExporter](https://mastra.ai/reference/observability/tracing/exporters/console-exporter): Debug output
|
|
257
|
+
- [Langfuse](https://mastra.ai/reference/observability/tracing/exporters/langfuse): Langfuse integration
|
|
258
|
+
- [Braintrust](https://mastra.ai/reference/observability/tracing/exporters/braintrust): Braintrust integration
|
|
259
|
+
|
|
260
|
+
### Reference
|
|
261
|
+
|
|
262
|
+
- [Configuration](https://mastra.ai/reference/observability/tracing/configuration): Configuration options
|
|
263
|
+
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces): Type definitions
|