@mastra/mcp-docs-server 0.13.24 → 0.13.25-alpha.0
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/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +11 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +70 -70
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +25 -25
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +30 -30
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Flance.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +50 -50
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Frag.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Freact-hooks.md +8 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +36 -36
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +22 -22
- package/.docs/organized/changelogs/mastra.md +46 -46
- package/.docs/raw/index.mdx +1 -0
- package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +81 -0
- package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +120 -0
- package/.docs/raw/observability/ai-tracing/exporters/default.mdx +167 -0
- package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +121 -0
- package/.docs/raw/observability/ai-tracing/overview.mdx +565 -0
- package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +274 -0
- package/.docs/raw/observability/{tracing.mdx → otel-tracing.mdx} +2 -2
- package/.docs/raw/observability/overview.mdx +66 -0
- package/.docs/raw/reference/agents/generate.mdx +39 -1
- package/.docs/raw/reference/agents/generateVNext.mdx +34 -2
- package/.docs/raw/reference/agents/network.mdx +34 -2
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +181 -0
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +233 -0
- package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +112 -0
- package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +176 -0
- package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +148 -0
- package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +196 -0
- package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +116 -0
- package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +651 -0
- package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +178 -0
- package/.docs/raw/reference/observability/ai-tracing/span.mdx +371 -0
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +22 -0
- package/.docs/raw/reference/streaming/agents/stream.mdx +39 -1
- package/.docs/raw/reference/streaming/agents/streamVNext.mdx +34 -2
- package/.docs/raw/reference/streaming/workflows/stream.mdx +38 -0
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +38 -0
- package/.docs/raw/reference/tools/create-tool.mdx +34 -1
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +38 -0
- package/.docs/raw/reference/workflows/run-methods/start.mdx +38 -0
- package/CHANGELOG.md +7 -0
- package/package.json +3 -3
- package/.docs/raw/observability/ai-tracing.mdx +0 -597
- package/.docs/raw/reference/observability/providers/index.mdx +0 -20
- /package/.docs/raw/reference/observability/{logger.mdx → logging/pino-logger.mdx} +0 -0
- /package/.docs/raw/reference/observability/{otel-config.mdx → otel-tracing/otel-config.mdx} +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/arize-ax.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/arize-phoenix.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/braintrust.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/dash0.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/keywordsai.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/laminar.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/langfuse.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/langsmith.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/langwatch.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/new-relic.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/signoz.mdx +0 -0
- /package/.docs/raw/reference/observability/{providers → otel-tracing/providers}/traceloop.mdx +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "SensitiveDataFilter | Processors | AI Tracing | Reference"
|
|
3
|
+
description: API reference for the SensitiveDataFilter processor
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { PropertiesTable } from "@/components/properties-table";
|
|
7
|
+
|
|
8
|
+
# SensitiveDataFilter
|
|
9
|
+
|
|
10
|
+
An AISpanProcessor that redacts sensitive information from span fields.
|
|
11
|
+
|
|
12
|
+
## Constructor
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
new SensitiveDataFilter(options?: SensitiveDataFilterOptions)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## SensitiveDataFilterOptions
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
interface SensitiveDataFilterOptions {
|
|
22
|
+
/**
|
|
23
|
+
* List of sensitive field names to redact.
|
|
24
|
+
* Matching is case-insensitive and normalizes separators
|
|
25
|
+
* (api-key, api_key, Api Key → apikey).
|
|
26
|
+
* Defaults include: password, token, secret, key, apikey, auth,
|
|
27
|
+
* authorization, bearer, bearertoken, jwt, credential,
|
|
28
|
+
* clientsecret, privatekey, refresh, ssn.
|
|
29
|
+
*/
|
|
30
|
+
sensitiveFields?: string[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The token used for full redaction.
|
|
34
|
+
* Default: "[REDACTED]"
|
|
35
|
+
*/
|
|
36
|
+
redactionToken?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Style of redaction to use:
|
|
40
|
+
* - "full": always replace with redactionToken
|
|
41
|
+
* - "partial": show 3 characters from the start and end, redact the middle
|
|
42
|
+
* Default: "full"
|
|
43
|
+
*/
|
|
44
|
+
redactionStyle?: RedactionStyle;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<PropertiesTable
|
|
49
|
+
props={[
|
|
50
|
+
{
|
|
51
|
+
name: "sensitiveFields",
|
|
52
|
+
type: "string[]",
|
|
53
|
+
description: "Field names to redact (case-insensitive, separator-agnostic)",
|
|
54
|
+
required: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "redactionToken",
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "Replacement token for full redaction",
|
|
60
|
+
required: false,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "redactionStyle",
|
|
64
|
+
type: "'full' | 'partial'",
|
|
65
|
+
description: "Redaction style",
|
|
66
|
+
required: false,
|
|
67
|
+
},
|
|
68
|
+
]}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
## RedactionStyle
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
type RedactionStyle = 'full' | 'partial';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Methods
|
|
78
|
+
|
|
79
|
+
### process
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
process(span: AnyAISpan): AnyAISpan
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Process a span by filtering sensitive data across its key fields: attributes, metadata, input, output, and errorInfo.
|
|
86
|
+
|
|
87
|
+
<PropertiesTable
|
|
88
|
+
props={[
|
|
89
|
+
{
|
|
90
|
+
name: "span",
|
|
91
|
+
type: "AnyAISpan",
|
|
92
|
+
description: "The input span to filter",
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
]}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
**Returns:** A new span with sensitive values redacted.
|
|
99
|
+
|
|
100
|
+
### shutdown
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
async shutdown(): Promise<void>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
No cleanup needed for this processor.
|
|
107
|
+
|
|
108
|
+
## Properties
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
readonly name = 'sensitive-data-filter';
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Default Sensitive Fields
|
|
115
|
+
|
|
116
|
+
When no custom fields are provided:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
[
|
|
120
|
+
'password',
|
|
121
|
+
'token',
|
|
122
|
+
'secret',
|
|
123
|
+
'key',
|
|
124
|
+
'apikey',
|
|
125
|
+
'auth',
|
|
126
|
+
'authorization',
|
|
127
|
+
'bearer',
|
|
128
|
+
'bearertoken',
|
|
129
|
+
'jwt',
|
|
130
|
+
'credential',
|
|
131
|
+
'clientsecret',
|
|
132
|
+
'privatekey',
|
|
133
|
+
'refresh',
|
|
134
|
+
'ssn'
|
|
135
|
+
]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Processing Behavior
|
|
139
|
+
|
|
140
|
+
### Field Matching
|
|
141
|
+
|
|
142
|
+
- **Case-insensitive**: `APIKey`, `apikey`, `ApiKey` all match
|
|
143
|
+
- **Separator-agnostic**: `api-key`, `api_key`, `apiKey` are treated identically
|
|
144
|
+
- **Exact matching**: After normalization, fields must match exactly
|
|
145
|
+
- `token` matches `token`, `Token`, `TOKEN`
|
|
146
|
+
- `token` does NOT match `promptTokens` or `tokenCount`
|
|
147
|
+
|
|
148
|
+
### Redaction Styles
|
|
149
|
+
|
|
150
|
+
#### Full Redaction (default)
|
|
151
|
+
|
|
152
|
+
All matched values replaced with redactionToken.
|
|
153
|
+
|
|
154
|
+
#### Partial Redaction
|
|
155
|
+
|
|
156
|
+
- Shows first 3 and last 3 characters
|
|
157
|
+
- Values ≤ 6 characters are fully redacted
|
|
158
|
+
- Non-string values are converted to strings before partial redaction
|
|
159
|
+
|
|
160
|
+
### Error Handling
|
|
161
|
+
|
|
162
|
+
If filtering a field fails, the field is replaced with:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
{ error: { processor: "sensitive-data-filter" } }
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Processed Fields
|
|
169
|
+
|
|
170
|
+
The filter recursively processes:
|
|
171
|
+
|
|
172
|
+
- `span.attributes` - Span metadata and properties
|
|
173
|
+
- `span.metadata` - Custom metadata
|
|
174
|
+
- `span.input` - Input data
|
|
175
|
+
- `span.output` - Output data
|
|
176
|
+
- `span.errorInfo` - Error information
|
|
177
|
+
|
|
178
|
+
Handles nested objects, arrays, and circular references safely.
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Span | AI Tracing | Reference"
|
|
3
|
+
description: Span interfaces, methods, and lifecycle events
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { PropertiesTable } from "@/components/properties-table";
|
|
7
|
+
|
|
8
|
+
# Span
|
|
9
|
+
|
|
10
|
+
## BaseSpan
|
|
11
|
+
|
|
12
|
+
Base interface for all span types.
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
interface BaseSpan<TType extends AISpanType> {
|
|
16
|
+
/** Unique span identifier */
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/** OpenTelemetry-compatible trace ID (32 hex chars) */
|
|
20
|
+
traceId: string;
|
|
21
|
+
|
|
22
|
+
/** Name of the span */
|
|
23
|
+
name: string;
|
|
24
|
+
|
|
25
|
+
/** Type of the span */
|
|
26
|
+
type: TType;
|
|
27
|
+
|
|
28
|
+
/** When span started */
|
|
29
|
+
startTime: Date;
|
|
30
|
+
|
|
31
|
+
/** When span ended */
|
|
32
|
+
endTime?: Date;
|
|
33
|
+
|
|
34
|
+
/** Type-specific attributes */
|
|
35
|
+
attributes?: AISpanTypeMap[TType];
|
|
36
|
+
|
|
37
|
+
/** User-defined metadata */
|
|
38
|
+
metadata?: Record<string, any>;
|
|
39
|
+
|
|
40
|
+
/** Input passed at the start of the span */
|
|
41
|
+
input?: any;
|
|
42
|
+
|
|
43
|
+
/** Output generated at the end of the span */
|
|
44
|
+
output?: any;
|
|
45
|
+
|
|
46
|
+
/** Error information if span failed */
|
|
47
|
+
errorInfo?: {
|
|
48
|
+
message: string;
|
|
49
|
+
id?: string;
|
|
50
|
+
domain?: string;
|
|
51
|
+
category?: string;
|
|
52
|
+
details?: Record<string, any>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Is an event span? (occurs at startTime, has no endTime) */
|
|
56
|
+
isEvent: boolean;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## AISpan
|
|
61
|
+
|
|
62
|
+
AI Span interface, used internally for tracing. Extends BaseSpan with lifecycle methods and properties.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
interface AISpan<TType extends AISpanType> extends BaseSpan<TType> {
|
|
66
|
+
/** Is an internal span? (spans internal to the operation of mastra) */
|
|
67
|
+
isInternal: boolean;
|
|
68
|
+
|
|
69
|
+
/** Parent span reference (undefined for root spans) */
|
|
70
|
+
parent?: AnyAISpan;
|
|
71
|
+
|
|
72
|
+
/** Pointer to the AITracing instance */
|
|
73
|
+
aiTracing: AITracing;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Properties
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
/** Returns TRUE if the span is the root span of a trace */
|
|
81
|
+
get isRootSpan(): boolean
|
|
82
|
+
|
|
83
|
+
/** Returns TRUE if the span is a valid span (not a NO-OP Span) */
|
|
84
|
+
get isValid(): boolean
|
|
85
|
+
|
|
86
|
+
/** Get the closest parent spanId that isn't an internal span */
|
|
87
|
+
getParentSpanId(includeInternalSpans?: boolean): string | undefined
|
|
88
|
+
|
|
89
|
+
/** Returns a lightweight span ready for export */
|
|
90
|
+
exportSpan(includeInternalSpans?: boolean): ExportedAISpan<TType> | undefined
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Methods
|
|
94
|
+
|
|
95
|
+
#### end
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
end(options?: EndSpanOptions<TType>): void
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Ends the span and triggers export to configured exporters. Sets the `endTime` and optionally updates `output`, `metadata`, and `attributes`.
|
|
102
|
+
|
|
103
|
+
<PropertiesTable
|
|
104
|
+
props={[
|
|
105
|
+
{
|
|
106
|
+
name: "output",
|
|
107
|
+
type: "any",
|
|
108
|
+
description: "Final output data from the operation",
|
|
109
|
+
required: false,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "metadata",
|
|
113
|
+
type: "Record<string, any>",
|
|
114
|
+
description: "Additional metadata to merge",
|
|
115
|
+
required: false,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "attributes",
|
|
119
|
+
type: "Partial<AISpanTypeMap[TType]>",
|
|
120
|
+
description: "Type-specific attributes to update",
|
|
121
|
+
required: false,
|
|
122
|
+
},
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
#### error
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
error(options: ErrorSpanOptions<TType>): void
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Records an error on the span. Sets the `errorInfo` field and can optionally end the span.
|
|
133
|
+
|
|
134
|
+
<PropertiesTable
|
|
135
|
+
props={[
|
|
136
|
+
{
|
|
137
|
+
name: "error",
|
|
138
|
+
type: "Error",
|
|
139
|
+
description: "The error that occurred",
|
|
140
|
+
required: true,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "endSpan",
|
|
144
|
+
type: "boolean",
|
|
145
|
+
description: "Whether to end the span after recording the error",
|
|
146
|
+
required: false,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "metadata",
|
|
150
|
+
type: "Record<string, any>",
|
|
151
|
+
description: "Additional error context metadata",
|
|
152
|
+
required: false,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "attributes",
|
|
156
|
+
type: "Partial<AISpanTypeMap[TType]>",
|
|
157
|
+
description: "Type-specific attributes to update",
|
|
158
|
+
required: false,
|
|
159
|
+
},
|
|
160
|
+
]}
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
#### update
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
update(options: UpdateSpanOptions<TType>): void
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Updates span data while it's still active. Can modify `input`, `output`, `metadata`, and `attributes`.
|
|
170
|
+
|
|
171
|
+
<PropertiesTable
|
|
172
|
+
props={[
|
|
173
|
+
{
|
|
174
|
+
name: "input",
|
|
175
|
+
type: "any",
|
|
176
|
+
description: "Update or set input data",
|
|
177
|
+
required: false,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "output",
|
|
181
|
+
type: "any",
|
|
182
|
+
description: "Update or set output data",
|
|
183
|
+
required: false,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "metadata",
|
|
187
|
+
type: "Record<string, any>",
|
|
188
|
+
description: "Metadata to merge with existing",
|
|
189
|
+
required: false,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "attributes",
|
|
193
|
+
type: "Partial<AISpanTypeMap[TType]>",
|
|
194
|
+
description: "Type-specific attributes to update",
|
|
195
|
+
required: false,
|
|
196
|
+
},
|
|
197
|
+
]}
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
#### createChildSpan
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
createChildSpan<TChildType extends AISpanType>(
|
|
204
|
+
options: ChildSpanOptions<TChildType>
|
|
205
|
+
): AISpan<TChildType>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Creates a child span under this span. Child spans track sub-operations and inherit the trace context.
|
|
209
|
+
|
|
210
|
+
<PropertiesTable
|
|
211
|
+
props={[
|
|
212
|
+
{
|
|
213
|
+
name: "type",
|
|
214
|
+
type: "TChildType",
|
|
215
|
+
description: "Type of the child span",
|
|
216
|
+
required: true,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "name",
|
|
220
|
+
type: "string",
|
|
221
|
+
description: "Name of the child span",
|
|
222
|
+
required: true,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "attributes",
|
|
226
|
+
type: "AISpanTypeMap[TChildType]",
|
|
227
|
+
description: "Type-specific attributes",
|
|
228
|
+
required: false,
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "metadata",
|
|
232
|
+
type: "Record<string, any>",
|
|
233
|
+
description: "Initial metadata",
|
|
234
|
+
required: false,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "input",
|
|
238
|
+
type: "any",
|
|
239
|
+
description: "Initial input data",
|
|
240
|
+
required: false,
|
|
241
|
+
},
|
|
242
|
+
]}
|
|
243
|
+
/>
|
|
244
|
+
|
|
245
|
+
#### createEventSpan
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
createEventSpan<TChildType extends AISpanType>(
|
|
249
|
+
options: ChildEventOptions<TChildType>
|
|
250
|
+
): AISpan<TChildType>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Creates an event span under this span. Event spans represent point-in-time occurrences with no duration.
|
|
254
|
+
|
|
255
|
+
<PropertiesTable
|
|
256
|
+
props={[
|
|
257
|
+
{
|
|
258
|
+
name: "type",
|
|
259
|
+
type: "TChildType",
|
|
260
|
+
description: "Type of the event span",
|
|
261
|
+
required: true,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "name",
|
|
265
|
+
type: "string",
|
|
266
|
+
description: "Name of the event",
|
|
267
|
+
required: true,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "attributes",
|
|
271
|
+
type: "AISpanTypeMap[TChildType]",
|
|
272
|
+
description: "Type-specific attributes",
|
|
273
|
+
required: false,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: "metadata",
|
|
277
|
+
type: "Record<string, any>",
|
|
278
|
+
description: "Event metadata",
|
|
279
|
+
required: false,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "input",
|
|
283
|
+
type: "any",
|
|
284
|
+
description: "Event input data",
|
|
285
|
+
required: false,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "output",
|
|
289
|
+
type: "any",
|
|
290
|
+
description: "Event output data",
|
|
291
|
+
required: false,
|
|
292
|
+
},
|
|
293
|
+
]}
|
|
294
|
+
/>
|
|
295
|
+
|
|
296
|
+
## ExportedAISpan
|
|
297
|
+
|
|
298
|
+
Exported AI Span interface, used for tracing exporters. A lightweight version of AISpan without methods or circular references.
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
interface ExportedAISpan<TType extends AISpanType> extends BaseSpan<TType> {
|
|
302
|
+
/** Parent span id reference (undefined for root spans) */
|
|
303
|
+
parentSpanId?: string;
|
|
304
|
+
|
|
305
|
+
/** TRUE if the span is the root span of a trace */
|
|
306
|
+
isRootSpan: boolean;
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Span Lifecycle Events
|
|
311
|
+
|
|
312
|
+
Events emitted during the span lifecycle.
|
|
313
|
+
|
|
314
|
+
### AITracingEventType
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
enum AITracingEventType {
|
|
318
|
+
/** Emitted when a span is created and started */
|
|
319
|
+
SPAN_STARTED = 'span_started',
|
|
320
|
+
|
|
321
|
+
/** Emitted when a span is updated via update() */
|
|
322
|
+
SPAN_UPDATED = 'span_updated',
|
|
323
|
+
|
|
324
|
+
/** Emitted when a span is ended via end() or error() */
|
|
325
|
+
SPAN_ENDED = 'span_ended',
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### AITracingEvent
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
type AITracingEvent =
|
|
333
|
+
| { type: 'span_started'; exportedSpan: AnyExportedAISpan }
|
|
334
|
+
| { type: 'span_updated'; exportedSpan: AnyExportedAISpan }
|
|
335
|
+
| { type: 'span_ended'; exportedSpan: AnyExportedAISpan };
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Exporters receive these events to process and send trace data to observability platforms.
|
|
339
|
+
|
|
340
|
+
## Union Types
|
|
341
|
+
|
|
342
|
+
### AnyAISpan
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
type AnyAISpan = AISpan<keyof AISpanTypeMap>;
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Union type for cases that need to handle any span type.
|
|
349
|
+
|
|
350
|
+
### AnyExportedAISpan
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
type AnyExportedAISpan = ExportedAISpan<keyof AISpanTypeMap>;
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Union type for cases that need to handle any exported span type.
|
|
357
|
+
|
|
358
|
+
## See Also
|
|
359
|
+
|
|
360
|
+
### Documentation
|
|
361
|
+
- [AI Tracing Overview](/docs/observability/ai-tracing/overview) - Concepts and usage
|
|
362
|
+
- [Creating Child Spans](/docs/observability/ai-tracing/overview#creating-child-spans) - Practical examples
|
|
363
|
+
- [Retrieving Trace IDs](/docs/observability/ai-tracing/overview#retrieving-trace-ids) - Using trace IDs
|
|
364
|
+
|
|
365
|
+
### Reference
|
|
366
|
+
- [AITracing Classes](/reference/observability/ai-tracing/ai-tracing) - Core tracing classes
|
|
367
|
+
- [Interfaces](/reference/observability/ai-tracing/interfaces) - Complete type reference
|
|
368
|
+
- [Configuration](/reference/observability/ai-tracing/configuration) - Configuration options
|
|
369
|
+
|
|
370
|
+
### Examples
|
|
371
|
+
- [Basic AI Tracing](/examples/observability/basic-ai-tracing) - Working with spans
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "OTLP Providers | Observability | Mastra Docs"
|
|
3
|
+
description: Overview of OTLP observability providers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Callout } from "nextra/components";
|
|
7
|
+
|
|
8
|
+
# OTLP Providers
|
|
9
|
+
|
|
10
|
+
These providers are supported with OTLP-based tracing:
|
|
11
|
+
|
|
12
|
+
- [Arize AX](./arize-ax.mdx)
|
|
13
|
+
- [Arize Phoenix](./arize-phoenix.mdx)
|
|
14
|
+
- [Braintrust](./braintrust.mdx)
|
|
15
|
+
- [Dash0](./dash0.mdx)
|
|
16
|
+
- [Laminar](./laminar.mdx)
|
|
17
|
+
- [Langfuse](./langfuse.mdx)
|
|
18
|
+
- [Langsmith](./langsmith.mdx)
|
|
19
|
+
- [LangWatch](./langwatch.mdx)
|
|
20
|
+
- [New Relic](./new-relic.mdx)
|
|
21
|
+
- [SigNoz](./signoz.mdx)
|
|
22
|
+
- [Traceloop](./traceloop.mdx)
|
|
@@ -182,7 +182,7 @@ await agent.stream("message for agent");
|
|
|
182
182
|
type: "TelemetrySettings",
|
|
183
183
|
isOptional: true,
|
|
184
184
|
description:
|
|
185
|
-
"Settings for telemetry collection during streaming.",
|
|
185
|
+
"Settings for OTLP telemetry collection during streaming (not AI tracing).",
|
|
186
186
|
properties: [
|
|
187
187
|
{
|
|
188
188
|
parameters: [{
|
|
@@ -341,6 +341,38 @@ await agent.stream("message for agent");
|
|
|
341
341
|
isOptional: true,
|
|
342
342
|
description: "Runtime context for dependency injection and contextual information.",
|
|
343
343
|
},
|
|
344
|
+
{
|
|
345
|
+
name: "tracingContext",
|
|
346
|
+
type: "TracingContext",
|
|
347
|
+
isOptional: true,
|
|
348
|
+
description: "AI tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.",
|
|
349
|
+
properties: [
|
|
350
|
+
{
|
|
351
|
+
parameters: [{
|
|
352
|
+
name: "currentSpan",
|
|
353
|
+
type: "AISpan",
|
|
354
|
+
isOptional: true,
|
|
355
|
+
description: "Current AI span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution."
|
|
356
|
+
}]
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: "tracingOptions",
|
|
362
|
+
type: "TracingOptions",
|
|
363
|
+
isOptional: true,
|
|
364
|
+
description: "Options for AI tracing configuration.",
|
|
365
|
+
properties: [
|
|
366
|
+
{
|
|
367
|
+
parameters: [{
|
|
368
|
+
name: "metadata",
|
|
369
|
+
type: "Record<string, any>",
|
|
370
|
+
isOptional: true,
|
|
371
|
+
description: "Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags."
|
|
372
|
+
}]
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
},
|
|
344
376
|
{
|
|
345
377
|
name: "maxTokens",
|
|
346
378
|
type: "number",
|
|
@@ -456,6 +488,12 @@ await agent.stream("message for agent");
|
|
|
456
488
|
}
|
|
457
489
|
]
|
|
458
490
|
},
|
|
491
|
+
{
|
|
492
|
+
name: "traceId",
|
|
493
|
+
type: "string",
|
|
494
|
+
isOptional: true,
|
|
495
|
+
description: "The trace ID associated with this execution when AI tracing is enabled. Use this to correlate logs and debug execution flow.",
|
|
496
|
+
},
|
|
459
497
|
]}
|
|
460
498
|
/>
|
|
461
499
|
|
|
@@ -105,6 +105,32 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
|
|
|
105
105
|
type: "TracingContext",
|
|
106
106
|
isOptional: true,
|
|
107
107
|
description: "AI tracing context for span hierarchy and metadata.",
|
|
108
|
+
properties: [
|
|
109
|
+
{
|
|
110
|
+
parameters: [{
|
|
111
|
+
name: "currentSpan",
|
|
112
|
+
type: "AISpan",
|
|
113
|
+
isOptional: true,
|
|
114
|
+
description: "Current AI span for creating child spans and adding metadata."
|
|
115
|
+
}]
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "tracingOptions",
|
|
121
|
+
type: "TracingOptions",
|
|
122
|
+
isOptional: true,
|
|
123
|
+
description: "Options for AI tracing configuration.",
|
|
124
|
+
properties: [
|
|
125
|
+
{
|
|
126
|
+
parameters: [{
|
|
127
|
+
name: "metadata",
|
|
128
|
+
type: "Record<string, any>",
|
|
129
|
+
isOptional: true,
|
|
130
|
+
description: "Metadata to add to the root trace span."
|
|
131
|
+
}]
|
|
132
|
+
}
|
|
133
|
+
]
|
|
108
134
|
},
|
|
109
135
|
{
|
|
110
136
|
name: "returnScorerData",
|
|
@@ -292,7 +318,7 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
|
|
|
292
318
|
type: "TelemetrySettings",
|
|
293
319
|
isOptional: true,
|
|
294
320
|
description:
|
|
295
|
-
"Settings for telemetry collection during streaming.",
|
|
321
|
+
"Settings for OTLP telemetry collection during streaming (not AI tracing).",
|
|
296
322
|
properties: [
|
|
297
323
|
{
|
|
298
324
|
parameters: [{
|
|
@@ -525,7 +551,13 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
|
|
|
525
551
|
{
|
|
526
552
|
name: "stream",
|
|
527
553
|
type: "MastraModelOutput<Output> | AISDKV5OutputStream<Output>",
|
|
528
|
-
description: "Returns a streaming interface based on the format parameter. When format is 'mastra' (default), returns MastraModelOutput. When format is 'aisdk', returns AISDKV5OutputStream for AI SDK v5 compatibility.",
|
|
554
|
+
description: "Returns a streaming interface based on the format parameter. When format is 'mastra' (default), returns MastraModelOutput with traceId property. When format is 'aisdk', returns AISDKV5OutputStream for AI SDK v5 compatibility.",
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: "traceId",
|
|
558
|
+
type: "string",
|
|
559
|
+
isOptional: true,
|
|
560
|
+
description: "The trace ID associated with this execution when AI tracing is enabled. Available via stream.traceId for Mastra format.",
|
|
529
561
|
},
|
|
530
562
|
]}
|
|
531
563
|
/>
|