@mastra/observability 1.24.4-alpha.0 → 1.24.4-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +39 -39
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +3 -189
- package/dist/docs/references/integrations-observability-langfuse.md +1 -1
- package/dist/docs/references/integrations-observability-langsmith.md +6 -0
- package/dist/docs/references/reference-observability-tracing-exporters-cloud-exporter.md +1 -1
- package/dist/docs/references/reference-observability-tracing-exporters-default-exporter.md +3 -3
- package/dist/docs/references/reference-observability-tracing-exporters-mastra-storage-exporter.md +1 -1
- package/dist/docs/references/reference-observability-tracing-exporters-sentry.md +1 -1
- package/dist/index.cjs +1435 -1989
- package/dist/index.js +1435 -1989
- package/package.json +4 -4
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.24.4-alpha.
|
|
6
|
+
version: "1.24.4-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.24.4-alpha.
|
|
2
|
+
"version": "1.24.4-alpha.1",
|
|
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":
|
|
8
|
+
"line": 67726
|
|
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":
|
|
18
|
+
"line": 69760
|
|
19
19
|
},
|
|
20
20
|
"BaseSpan": {
|
|
21
21
|
"types": "dist/spans/base.d.ts",
|
|
22
22
|
"implementation": "dist/index.js",
|
|
23
|
-
"line":
|
|
23
|
+
"line": 66985
|
|
24
24
|
},
|
|
25
25
|
"CardinalityFilter": {
|
|
26
26
|
"types": "dist/metrics/cardinality.d.ts",
|
|
27
27
|
"implementation": "dist/index.js",
|
|
28
|
-
"line":
|
|
28
|
+
"line": 65474
|
|
29
29
|
},
|
|
30
30
|
"CloudExporter": {
|
|
31
31
|
"types": "dist/exporters/cloud.d.ts",
|
|
32
32
|
"implementation": "dist/index.js",
|
|
33
|
-
"line":
|
|
33
|
+
"line": 72208
|
|
34
34
|
},
|
|
35
35
|
"ConsoleExporter": {
|
|
36
36
|
"types": "dist/exporters/console.d.ts",
|
|
37
37
|
"implementation": "dist/index.js",
|
|
38
|
-
"line":
|
|
38
|
+
"line": 72531
|
|
39
39
|
},
|
|
40
40
|
"DEFAULT_DEEP_CLEAN_OPTIONS": {
|
|
41
41
|
"types": "dist/spans/serialization.d.ts",
|
|
@@ -45,27 +45,27 @@
|
|
|
45
45
|
"DEFAULT_LIMITS": {
|
|
46
46
|
"types": "dist/client/proxy.d.ts",
|
|
47
47
|
"implementation": "dist/index.js",
|
|
48
|
-
"line":
|
|
48
|
+
"line": 70766
|
|
49
49
|
},
|
|
50
50
|
"DefaultExporter": {
|
|
51
51
|
"types": "dist/exporters/default.d.ts",
|
|
52
52
|
"implementation": "dist/index.js",
|
|
53
|
-
"line":
|
|
53
|
+
"line": 68541
|
|
54
54
|
},
|
|
55
55
|
"DefaultObservabilityInstance": {
|
|
56
56
|
"types": "dist/instances/default.d.ts",
|
|
57
57
|
"implementation": "dist/index.js",
|
|
58
|
-
"line":
|
|
58
|
+
"line": 74464
|
|
59
59
|
},
|
|
60
60
|
"DefaultSpan": {
|
|
61
61
|
"types": "dist/spans/default.d.ts",
|
|
62
62
|
"implementation": "dist/index.js",
|
|
63
|
-
"line":
|
|
63
|
+
"line": 67493
|
|
64
64
|
},
|
|
65
65
|
"JsonExporter": {
|
|
66
66
|
"types": "dist/exporters/test.d.ts",
|
|
67
67
|
"implementation": "dist/index.js",
|
|
68
|
-
"line":
|
|
68
|
+
"line": 74462
|
|
69
69
|
},
|
|
70
70
|
"LoggerContextImpl": {
|
|
71
71
|
"types": "dist/context/logger.d.ts",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"MastraPlatformExporter": {
|
|
76
76
|
"types": "dist/exporters/mastra-platform.d.ts",
|
|
77
77
|
"implementation": "dist/index.js",
|
|
78
|
-
"line":
|
|
78
|
+
"line": 72861
|
|
79
79
|
},
|
|
80
80
|
"MastraStorageExporter": {
|
|
81
81
|
"types": "dist/exporters/mastra-storage.d.ts",
|
|
82
82
|
"implementation": "dist/index.js",
|
|
83
|
-
"line":
|
|
83
|
+
"line": 69106
|
|
84
84
|
},
|
|
85
85
|
"MetricsContextImpl": {
|
|
86
86
|
"types": "dist/context/metrics.d.ts",
|
|
@@ -90,22 +90,22 @@
|
|
|
90
90
|
"ModelSpanTracker": {
|
|
91
91
|
"types": "dist/model-tracing.d.ts",
|
|
92
92
|
"implementation": "dist/index.js",
|
|
93
|
-
"line":
|
|
93
|
+
"line": 65917
|
|
94
94
|
},
|
|
95
95
|
"NoOpSpan": {
|
|
96
96
|
"types": "dist/spans/no-op.d.ts",
|
|
97
97
|
"implementation": "dist/index.js",
|
|
98
|
-
"line":
|
|
98
|
+
"line": 67669
|
|
99
99
|
},
|
|
100
100
|
"OBSERVABILITY_CAPABILITIES_HEADER": {
|
|
101
101
|
"types": "dist/exporters/mastra-platform.d.ts",
|
|
102
102
|
"implementation": "dist/index.js",
|
|
103
|
-
"line":
|
|
103
|
+
"line": 72762
|
|
104
104
|
},
|
|
105
105
|
"Observability": {
|
|
106
106
|
"types": "dist/default.d.ts",
|
|
107
107
|
"implementation": "dist/index.js",
|
|
108
|
-
"line":
|
|
108
|
+
"line": 74800
|
|
109
109
|
},
|
|
110
110
|
"ObservabilityBus": {
|
|
111
111
|
"types": "dist/bus/observability-bus.d.ts",
|
|
@@ -115,12 +115,12 @@
|
|
|
115
115
|
"QUOTA_PAUSE_CAPABILITY": {
|
|
116
116
|
"types": "dist/exporters/mastra-platform.d.ts",
|
|
117
117
|
"implementation": "dist/index.js",
|
|
118
|
-
"line":
|
|
118
|
+
"line": 72763
|
|
119
119
|
},
|
|
120
120
|
"REDACTED_ERROR_MESSAGE": {
|
|
121
121
|
"types": "dist/spans/base.d.ts",
|
|
122
122
|
"implementation": "dist/index.js",
|
|
123
|
-
"line":
|
|
123
|
+
"line": 66846
|
|
124
124
|
},
|
|
125
125
|
"SamplingStrategyType": {
|
|
126
126
|
"types": "dist/config.d.ts",
|
|
@@ -130,57 +130,57 @@
|
|
|
130
130
|
"SensitiveDataFilter": {
|
|
131
131
|
"types": "dist/span_processors/sensitive-data-filter.d.ts",
|
|
132
132
|
"implementation": "dist/index.js",
|
|
133
|
-
"line":
|
|
133
|
+
"line": 74587
|
|
134
134
|
},
|
|
135
135
|
"TestExporter": {
|
|
136
136
|
"types": "dist/exporters/test.d.ts",
|
|
137
137
|
"implementation": "dist/index.js",
|
|
138
|
-
"line":
|
|
138
|
+
"line": 73472
|
|
139
139
|
},
|
|
140
140
|
"TraceData": {
|
|
141
141
|
"types": "dist/exporters/tracking.d.ts",
|
|
142
142
|
"implementation": "dist/index.js",
|
|
143
|
-
"line":
|
|
143
|
+
"line": 70927
|
|
144
144
|
},
|
|
145
145
|
"TrackingExporter": {
|
|
146
146
|
"types": "dist/exporters/tracking.d.ts",
|
|
147
147
|
"implementation": "dist/index.js",
|
|
148
|
-
"line":
|
|
148
|
+
"line": 71256
|
|
149
149
|
},
|
|
150
150
|
"buildExportedLog": {
|
|
151
151
|
"types": "dist/client/otlp.d.ts",
|
|
152
152
|
"implementation": "dist/index.js",
|
|
153
|
-
"line":
|
|
153
|
+
"line": 70683
|
|
154
154
|
},
|
|
155
155
|
"buildExportedSpan": {
|
|
156
156
|
"types": "dist/client/otlp.d.ts",
|
|
157
157
|
"implementation": "dist/index.js",
|
|
158
|
-
"line":
|
|
158
|
+
"line": 70665
|
|
159
159
|
},
|
|
160
160
|
"buildTracingOptions": {
|
|
161
161
|
"types": "dist/tracing-options.d.ts",
|
|
162
162
|
"implementation": "dist/index.js",
|
|
163
|
-
"line":
|
|
163
|
+
"line": 75141
|
|
164
164
|
},
|
|
165
165
|
"chainFormatters": {
|
|
166
166
|
"types": "dist/exporters/span-formatters.d.ts",
|
|
167
167
|
"implementation": "dist/index.js",
|
|
168
|
-
"line":
|
|
168
|
+
"line": 72022
|
|
169
169
|
},
|
|
170
170
|
"createClientObservabilityProxy": {
|
|
171
171
|
"types": "dist/client/proxy.d.ts",
|
|
172
172
|
"implementation": "dist/index.js",
|
|
173
|
-
"line":
|
|
173
|
+
"line": 70908
|
|
174
174
|
},
|
|
175
175
|
"decodeResourceLogs": {
|
|
176
176
|
"types": "dist/client/otlp.d.ts",
|
|
177
177
|
"implementation": "dist/index.js",
|
|
178
|
-
"line":
|
|
178
|
+
"line": 70602
|
|
179
179
|
},
|
|
180
180
|
"decodeResourceSpans": {
|
|
181
181
|
"types": "dist/client/otlp.d.ts",
|
|
182
182
|
"implementation": "dist/index.js",
|
|
183
|
-
"line":
|
|
183
|
+
"line": 70564
|
|
184
184
|
},
|
|
185
185
|
"deepClean": {
|
|
186
186
|
"types": "dist/spans/serialization.d.ts",
|
|
@@ -190,17 +190,17 @@
|
|
|
190
190
|
"formatBaggage": {
|
|
191
191
|
"types": "dist/client/w3c.d.ts",
|
|
192
192
|
"implementation": "dist/index.js",
|
|
193
|
-
"line":
|
|
193
|
+
"line": 70756
|
|
194
194
|
},
|
|
195
195
|
"formatTraceparent": {
|
|
196
196
|
"types": "dist/client/w3c.d.ts",
|
|
197
197
|
"implementation": "dist/index.js",
|
|
198
|
-
"line":
|
|
198
|
+
"line": 70719
|
|
199
199
|
},
|
|
200
200
|
"getExternalParentId": {
|
|
201
201
|
"types": "dist/spans/base.d.ts",
|
|
202
202
|
"implementation": "dist/index.js",
|
|
203
|
-
"line":
|
|
203
|
+
"line": 66966
|
|
204
204
|
},
|
|
205
205
|
"isSerializedMap": {
|
|
206
206
|
"types": "dist/spans/serialization.d.ts",
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"observabilityFeatures": {
|
|
221
221
|
"types": "dist/features.d.ts",
|
|
222
222
|
"implementation": "dist/index.js",
|
|
223
|
-
"line":
|
|
223
|
+
"line": 75122
|
|
224
224
|
},
|
|
225
225
|
"observabilityInstanceConfigSchema": {
|
|
226
226
|
"types": "dist/config.d.ts",
|
|
@@ -235,17 +235,17 @@
|
|
|
235
235
|
"otlpSeverityToLogLevel": {
|
|
236
236
|
"types": "dist/client/otlp.d.ts",
|
|
237
237
|
"implementation": "dist/index.js",
|
|
238
|
-
"line":
|
|
238
|
+
"line": 70639
|
|
239
239
|
},
|
|
240
240
|
"parseBaggage": {
|
|
241
241
|
"types": "dist/client/w3c.d.ts",
|
|
242
242
|
"implementation": "dist/index.js",
|
|
243
|
-
"line":
|
|
243
|
+
"line": 70729
|
|
244
244
|
},
|
|
245
245
|
"parseTraceparent": {
|
|
246
246
|
"types": "dist/client/w3c.d.ts",
|
|
247
247
|
"implementation": "dist/index.js",
|
|
248
|
-
"line":
|
|
248
|
+
"line": 70705
|
|
249
249
|
},
|
|
250
250
|
"reconstructSerializedMap": {
|
|
251
251
|
"types": "dist/spans/serialization.d.ts",
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
"redactErrorInfo": {
|
|
256
256
|
"types": "dist/spans/base.d.ts",
|
|
257
257
|
"implementation": "dist/index.js",
|
|
258
|
-
"line":
|
|
258
|
+
"line": 66852
|
|
259
259
|
},
|
|
260
260
|
"routeToHandler": {
|
|
261
261
|
"types": "dist/bus/route-event.d.ts",
|
|
@@ -136,6 +136,8 @@ Open your project in [Mastra Platform](https://projects.mastra.ai) to inspect ex
|
|
|
136
136
|
|
|
137
137
|
Use a consistent `serviceName` to filter data from a specific application or deployment.
|
|
138
138
|
|
|
139
|
+
To get notified when a value such as an error rate or cost crosses a threshold, [create alerts](https://mastra.ai/docs/mastra-platform/observability/alerts).
|
|
140
|
+
|
|
139
141
|
## Query observability data
|
|
140
142
|
|
|
141
143
|
Browse hosted traces from the terminal with the Mastra CLI:
|
|
@@ -218,195 +220,7 @@ You can query exported metrics over HTTP, with `MastraClient`, or with `mastra a
|
|
|
218
220
|
|
|
219
221
|
## Import existing traces
|
|
220
222
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
The import command currently supports Langfuse. Additional providers can use the same command workflow when their adapters are added.
|
|
224
|
-
|
|
225
|
-
| Provider | Command argument | Source requirement |
|
|
226
|
-
| -------- | ---------------- | -------------------------------------------------- |
|
|
227
|
-
| Langfuse | `langfuse` | Langfuse Cloud or self-hosted Langfuse v4 or later |
|
|
228
|
-
|
|
229
|
-
### Prerequisites
|
|
230
|
-
|
|
231
|
-
Before starting an import, you need:
|
|
232
|
-
|
|
233
|
-
- A Mastra Platform project.
|
|
234
|
-
- Mastra Platform authentication through `mastra auth login`, or a `MASTRA_API_TOKEN` and `MASTRA_ORG_ID` for a headless environment.
|
|
235
|
-
- `MASTRA_PLATFORM_ACCESS_TOKEN` for upload and read-back when using an interactive login. A dry run doesn't require this token.
|
|
236
|
-
- Credentials for a supported source provider.
|
|
237
|
-
- Enough local disk space to temporarily store the prepared traces.
|
|
238
|
-
|
|
239
|
-
### Configure the destination
|
|
240
|
-
|
|
241
|
-
For an interactive import, sign in and select the organization that owns the destination project:
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
npx mastra auth login
|
|
245
|
-
npx mastra auth orgs switch
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
Interactive login authorizes project discovery. Set the Platform access token used by the destination project before uploading or verifying traces:
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
MASTRA_PLATFORM_ACCESS_TOKEN=<mastra-platform-access-token>
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
If `mastra init` configured observability for the project, use the token it wrote to `.env`. Otherwise, create an access token in [Mastra Platform](https://projects.mastra.ai).
|
|
255
|
-
|
|
256
|
-
You can run `--dry-run` without this token because a dry run doesn't contact the collector or query API.
|
|
257
|
-
|
|
258
|
-
`--target-project` names the destination: the Mastra Platform project that receives the traces. Specify it with a project name, slug, or ID, or set `MASTRA_PROJECT_ID`:
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
npx mastra traces import langfuse --target-project my-mastra-project --dry-run
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
The `--target-project` flag takes precedence over `MASTRA_PROJECT_ID`. Without either value, the CLI uses the project linked in `.mastra-project.json`.
|
|
265
|
-
|
|
266
|
-
The source project isn't a command-line option. The provider credentials in `.env` select it, and the preparation summary names it before anything is uploaded.
|
|
267
|
-
|
|
268
|
-
For a headless environment, set the API token and organization ID. The command uses `MASTRA_API_TOKEN` for project discovery, upload, and read-back. Set the project ID or pass `--target-project`:
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
MASTRA_API_TOKEN=<mastra-api-token>
|
|
272
|
-
MASTRA_ORG_ID=<organization-id>
|
|
273
|
-
MASTRA_PROJECT_ID=<project-id>
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Configure Langfuse
|
|
277
|
-
|
|
278
|
-
Langfuse API keys belong to one Langfuse project, so they also select the source project. Create [project API keys in Langfuse](https://langfuse.com/docs/api-and-data-platform/features/public-api), then add them to `.env` or `.env.local` in the directory where you run the command:
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
LANGFUSE_PUBLIC_KEY=<langfuse-public-key>
|
|
282
|
-
LANGFUSE_SECRET_KEY=<langfuse-secret-key>
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Langfuse Cloud defaults to the EU region at `https://cloud.langfuse.com`. Set `LANGFUSE_BASE_URL` to the [regional host](https://langfuse.com/security/data-regions) for US, Japan, or HIPAA Cloud, or to the origin of a self-hosted instance:
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
LANGFUSE_BASE_URL=https://us.cloud.langfuse.com
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Preview the import
|
|
292
|
-
|
|
293
|
-
Run a dry run before uploading:
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
npx mastra traces import langfuse --target-project my-mastra-project --dry-run
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
The dry run reads the source, prepares valid Mastra traces locally, and reports:
|
|
300
|
-
|
|
301
|
-
- The source Langfuse project by name and ID, and the destination Mastra Platform project.
|
|
302
|
-
- The fixed import window.
|
|
303
|
-
- Prepared and skipped trace and span counts.
|
|
304
|
-
- The size of the prepared local data.
|
|
305
|
-
- Provider warnings and skip reasons in `report.json`.
|
|
306
|
-
|
|
307
|
-
It doesn't upload traces. The command prints a `--resume` command that uploads the prepared data later without reading the source again.
|
|
308
|
-
|
|
309
|
-
### Choose the import window
|
|
310
|
-
|
|
311
|
-
By default, the command selects the last 30 days, ending when the import starts. Use `--since` and `--until` to choose a smaller window:
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
npx mastra traces import langfuse \
|
|
315
|
-
--target-project my-mastra-project \
|
|
316
|
-
--since "$SINCE" \
|
|
317
|
-
--until "$UNTIL" \
|
|
318
|
-
--dry-run
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
Set `SINCE` and `UNTIL` to ISO 8601 dates or timestamps. The following rules apply:
|
|
322
|
-
|
|
323
|
-
- `--until` must be within the last 30 days and can't be in the future.
|
|
324
|
-
- `--since` must be earlier than `--until` and within the last 30 days.
|
|
325
|
-
- The selected window can't exceed 30 days.
|
|
326
|
-
- If only `--until` is set, the default start is 30 days before the current time.
|
|
327
|
-
|
|
328
|
-
This 30-day import window is separate from your plan's data retention period.
|
|
329
|
-
|
|
330
|
-
The earlier `--from` and `--to` names still work, but they're deprecated hidden aliases of `--since` and `--until` and don't appear in the command help. Use `--since` and `--until` in new commands.
|
|
331
|
-
|
|
332
|
-
Trace eligibility is based on the root observation's start time. The Langfuse adapter discovers roots in the selected window and then reads all currently available observations for each selected trace. It skips the complete trace if the available parent-child tree or timestamps are invalid.
|
|
333
|
-
|
|
334
|
-
### Upload and verify
|
|
335
|
-
|
|
336
|
-
Run the command without `--dry-run` to upload the prepared traces:
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
npx mastra traces import langfuse --target-project my-mastra-project
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
The CLI displays the preparation summary and asks for confirmation before upload. Pass `--yes` to skip this prompt in an automated environment:
|
|
343
|
-
|
|
344
|
-
```bash
|
|
345
|
-
npx mastra traces import langfuse --target-project my-mastra-project --yes
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
The importer keeps every trace in one upload request and checkpoints progress only after Mastra Platform acknowledges the batch. Temporary source and destination failures use bounded retries.
|
|
349
|
-
|
|
350
|
-
After every prepared trace is acknowledged, the importer reads back a deterministic sample of up to 10 traces. It verifies span IDs, parent links, names, span types, event flags, timestamps, and whether an error is present. It doesn't read back or compare input, output, attributes, metadata, or tags.
|
|
351
|
-
|
|
352
|
-
If read-back isn't available yet or a sampled trace differs, the import pauses and keeps its prepared data. Resume the import to retry verification without uploading acknowledged traces again.
|
|
353
|
-
|
|
354
|
-
### Resume an import
|
|
355
|
-
|
|
356
|
-
Use the exact command printed by the CLI when a dry run, cancellation, interruption, upload failure, or paused verification leaves an import unfinished:
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
npx mastra traces import langfuse \
|
|
360
|
-
--resume 00000000-0000-0000-0000-000000000000 \
|
|
361
|
-
--target-project my-mastra-project
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
A resumed import must use the original provider and destination project. Its saved date window can't be changed, so `--since`, `--until`, and `--dry-run` can't be combined with `--resume`.
|
|
365
|
-
|
|
366
|
-
Resume behavior depends on where the command stopped:
|
|
367
|
-
|
|
368
|
-
- An interrupted preparation reads and prepares the source again.
|
|
369
|
-
- An interrupted upload starts with the first unacknowledged trace.
|
|
370
|
-
- Paused verification retries read-back without re-uploading acknowledged traces.
|
|
371
|
-
- A completed import reports that it's already complete and retries any remaining local cleanup.
|
|
372
|
-
|
|
373
|
-
### Local files and cleanup
|
|
374
|
-
|
|
375
|
-
Import state is stored under:
|
|
376
|
-
|
|
377
|
-
```text
|
|
378
|
-
~/.mastra/imports/traces/<target-project-id>/<import-id>/
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
| File | Purpose | Lifecycle |
|
|
382
|
-
| --------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
383
|
-
| `manifest.json` | Stores the source identity, date window, counts, and acknowledged progress. | Retained after completion. |
|
|
384
|
-
| `traces.jsonl` | Stores one complete normalized trace per line. | Retained for dry runs and unfinished imports, then removed after successful verification. |
|
|
385
|
-
| `report.json` | Stores counts, warnings, skip samples, and verification results. | Retained after it's written. |
|
|
386
|
-
|
|
387
|
-
These files can contain trace content. Mastra creates the import directory and files with permissions restricted to the local user. Protect the machine and account that run the import.
|
|
388
|
-
|
|
389
|
-
### Imported data and limits
|
|
390
|
-
|
|
391
|
-
For Langfuse imports:
|
|
392
|
-
|
|
393
|
-
- Observations become Mastra spans with their parent-child relationships and timestamps.
|
|
394
|
-
- Langfuse `AGENT`, `TOOL`, and `EVALUATOR` observations, and plain spans that carry OpenTelemetry GenAI attributes such as `gen_ai.operation.name: invoke_agent`, keep their primitive type and name. Mastra Platform shows them in the Primitive type and Primitive name columns and includes them in those filters, like native traces.
|
|
395
|
-
- Supported fields such as names, input, output, errors, model details, usage, cost, tags, and source context are mapped when present.
|
|
396
|
-
- Environments you set in Langfuse, such as `staging`, are kept. Langfuse's built-in `default` environment isn't copied. Those traces have no environment in Mastra, and Mastra Studio shows them for every environment.
|
|
397
|
-
- Destination trace and span IDs are deterministic. Original Langfuse IDs remain in span metadata for correlation.
|
|
398
|
-
- Unknown Langfuse observation types become generic spans and produce a warning instead of being silently discarded.
|
|
399
|
-
- Only trace observations are imported. Scores, feedback, datasets, attachments, and logs aren't imported.
|
|
400
|
-
|
|
401
|
-
The shared importer also applies these limits:
|
|
402
|
-
|
|
403
|
-
- Prepared local trace data is limited to 5 GiB per import. Use a smaller date window if an import reaches this limit.
|
|
404
|
-
- A complete trace must fit within the importer's 4 MiB upload payload limit. A larger trace is skipped and recorded with the `trace_too_large` reason.
|
|
405
|
-
- A trace is never split between upload requests.
|
|
406
|
-
|
|
407
|
-
Review `report.json` after a dry run or completed import to see exactly what was prepared, skipped, acknowledged, and verified.
|
|
408
|
-
|
|
409
|
-
See the [`mastra traces import` CLI reference](https://mastra.ai/reference/cli/mastra) for the complete option and environment-variable reference.
|
|
223
|
+
To move trace history from another provider, such as Langfuse, into a Mastra Platform project, see [Import existing traces](https://mastra.ai/docs/mastra-platform/observability/import-traces).
|
|
410
224
|
|
|
411
225
|
## Next steps
|
|
412
226
|
|
|
@@ -312,7 +312,7 @@ When set on a `MODEL_GENERATION` span, the Langfuse exporter automatically links
|
|
|
312
312
|
|
|
313
313
|
## Import existing traces into Mastra Platform
|
|
314
314
|
|
|
315
|
-
The Mastra CLI can import historical trace observations from Langfuse Cloud or a self-hosted Langfuse v4 or later instance. This is separate from configuring the exporter on this page. See [Import existing traces](https://mastra.ai/docs/mastra-platform/observability/
|
|
315
|
+
The Mastra CLI can import historical trace observations from Langfuse Cloud or a self-hosted Langfuse v4 or later instance. This is separate from configuring the exporter on this page. See [Import existing traces](https://mastra.ai/docs/mastra-platform/observability/import-traces) for credentials, dry runs, resume, verification, and current limits.
|
|
316
316
|
|
|
317
317
|
## Related
|
|
318
318
|
|
|
@@ -209,6 +209,12 @@ await agent.generate('hi', { memory })
|
|
|
209
209
|
await agent.generate('and again', { memory })
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
+
## Trajectories
|
|
213
|
+
|
|
214
|
+
LangSmith builds a Thread's [Trajectory view](https://docs.langchain.com/langsmith/view-traces#trajectory-view), and the `trajectory` variable of [multi-turn online evaluators](https://docs.langchain.com/langsmith/online-evaluations-multi-turn), from `llm` runs. The exporter sends one `llm` run for each call to the model provider, with the conversation up to that call. The trajectory of an agent turn shows the user message, each tool call with its result, and the answer as the model returned it, before output processors change or reject it.
|
|
215
|
+
|
|
216
|
+
The model call that [generates a thread title](https://mastra.ai/docs/memory/message-history) stays in the trace but is left out of the trajectory, because it isn't part of the conversation.
|
|
217
|
+
|
|
212
218
|
## Scores and feedback
|
|
213
219
|
|
|
214
220
|
Scores sent through `mastra.observability.addScore()` show up in LangSmith as feedback on the matching run. A score with only a `traceId` is attached to the trace's root run. A score with a `spanId` is attached to that span's run.
|
|
@@ -160,7 +160,7 @@ Flushes remaining events and performs cleanup.
|
|
|
160
160
|
|
|
161
161
|
If no access token is provided via config or environment variable, the exporter:
|
|
162
162
|
|
|
163
|
-
- Logs a
|
|
163
|
+
- Logs a debug message that it's disabled
|
|
164
164
|
- Operates as a no-op (discards all events)
|
|
165
165
|
|
|
166
166
|
### Batching
|
|
@@ -48,7 +48,7 @@ Extends `BaseExporterConfig`, which includes:
|
|
|
48
48
|
## `TracingStorageStrategy`
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
|
-
type TracingStorageStrategy = 'realtime' | 'batch-with-updates' | 'insert-only'
|
|
51
|
+
type TracingStorageStrategy = 'realtime' | 'batch-with-updates' | 'insert-only' | 'event-sourced'
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
### Strategy behaviors
|
|
@@ -68,7 +68,7 @@ readonly name = 'mastra-default-observability-exporter';
|
|
|
68
68
|
### init
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
|
-
init(options: InitExporterOptions): void
|
|
71
|
+
init(options: InitExporterOptions): Promise<void>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
Initializes the exporter after dependencies are ready. Resolves tracing strategy based on storage capabilities.
|
|
@@ -132,7 +132,7 @@ The buffer flushes when any of these conditions are met:
|
|
|
132
132
|
|
|
133
133
|
Failed flushes are retried with exponential backoff:
|
|
134
134
|
|
|
135
|
-
- Retry delay: `retryDelayMs * 2^attempt`
|
|
135
|
+
- Retry delay: `retryDelayMs * 2^(attempt - 1)`. The first retry waits `retryDelayMs`.
|
|
136
136
|
- Maximum attempts: `maxRetries`
|
|
137
137
|
- Batch is dropped after all retries fail
|
|
138
138
|
|
package/dist/docs/references/reference-observability-tracing-exporters-mastra-storage-exporter.md
CHANGED
|
@@ -102,7 +102,7 @@ The deprecated `DefaultExporter` class continues to use `'mastra-default-observa
|
|
|
102
102
|
### init
|
|
103
103
|
|
|
104
104
|
```typescript
|
|
105
|
-
init(options: InitExporterOptions): void
|
|
105
|
+
init(options: InitExporterOptions): Promise<void>
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
Initializes the exporter after dependencies are ready. Resolves tracing strategy based on storage capabilities.
|
|
@@ -184,7 +184,7 @@ The exporter sets these standard OpenTelemetry attributes:
|
|
|
184
184
|
- `gen_ai.operation.name`: `invoke_agent`
|
|
185
185
|
- `gen_ai.agent.name`: Agent identifier
|
|
186
186
|
- `gen_ai.pipeline.name`: Agent name
|
|
187
|
-
- `gen_ai.
|
|
187
|
+
- `gen_ai.system_instructions`: Agent instructions
|
|
188
188
|
- `gen_ai.response.model`: Model from child generation
|
|
189
189
|
- `gen_ai.response.text`: Output from child generation
|
|
190
190
|
- `gen_ai.usage.*`: Token usage from child generation
|