@mastra/otel-exporter 0.0.0-fix-network-silence-20250930164151
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/CHANGELOG.md +10 -0
- package/LICENSE.md +15 -0
- package/README.md +435 -0
- package/dist/ai-tracing.d.ts +26 -0
- package/dist/ai-tracing.d.ts.map +1 -0
- package/dist/index.cjs +754 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +752 -0
- package/dist/index.js.map +1 -0
- package/dist/loadExporter.d.ts +6 -0
- package/dist/loadExporter.d.ts.map +1 -0
- package/dist/mastra-span.d.ts +37 -0
- package/dist/mastra-span.d.ts.map +1 -0
- package/dist/provider-configs.d.ts +11 -0
- package/dist/provider-configs.d.ts.map +1 -0
- package/dist/span-converter.d.ts +38 -0
- package/dist/span-converter.d.ts.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +93 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @mastra/otel-exporter
|
|
2
|
+
|
|
3
|
+
## 0.0.0-fix-network-silence-20250930164151
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Initial release of the otel-exporter for ai observability ([#8273](https://github.com/mastra-ai/mastra/pull/8273))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67), [`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`b342a68`](https://github.com/mastra-ai/mastra/commit/b342a68e1399cf1ece9ba11bda112db89d21118c), [`7fceb0a`](https://github.com/mastra-ai/mastra/commit/7fceb0a327d678e812f90f5387c5bc4f38bd039e), [`303a9c0`](https://github.com/mastra-ai/mastra/commit/303a9c0d7dd58795915979f06a0512359e4532fb), [`370f8a6`](https://github.com/mastra-ai/mastra/commit/370f8a6480faec70fef18d72e5f7538f27004301), [`809eea0`](https://github.com/mastra-ai/mastra/commit/809eea092fa80c3f69b9eaf078d843b57fd2a88e), [`bbf6157`](https://github.com/mastra-ai/mastra/commit/bbf615725917bce0a8d1084aea934c326bd16a27), [`623ffaf`](https://github.com/mastra-ai/mastra/commit/623ffaf2d969e11e99a0224633cf7b5a0815c857), [`9fc1613`](https://github.com/mastra-ai/mastra/commit/9fc16136400186648880fd990119ac15f7c02ee4), [`61f62aa`](https://github.com/mastra-ai/mastra/commit/61f62aa31bc88fe4ddf8da6240dbcfbeb07358bd), [`db1891a`](https://github.com/mastra-ai/mastra/commit/db1891a4707443720b7cd8a260dc7e1d49b3609c), [`e8f379d`](https://github.com/mastra-ai/mastra/commit/e8f379d390efa264c4e0874f9ac0cf8839b07777), [`3e292ba`](https://github.com/mastra-ai/mastra/commit/3e292ba00837886d5d68a34cbc0d9b703c991883), [`418c136`](https://github.com/mastra-ai/mastra/commit/418c1366843d88e491bca3f87763899ce855ca29), [`c2a4919`](https://github.com/mastra-ai/mastra/commit/c2a4919ba6797d8bdb1509e02287496eef69303e), [`c84b7d0`](https://github.com/mastra-ai/mastra/commit/c84b7d093c4657772140cbfd2b15ef72f3315ed5), [`0130986`](https://github.com/mastra-ai/mastra/commit/0130986fc62d0edcc626dd593282661dbb9af141)]:
|
|
10
|
+
- @mastra/core@0.0.0-fix-network-silence-20250930164151
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# OtelExporter - OpenTelemetry AI Tracing Exporter
|
|
2
|
+
|
|
3
|
+
Export Mastra AI traces to any OpenTelemetry-compatible observability platform.
|
|
4
|
+
|
|
5
|
+
> **⚠️ Important:** This package requires you to install an additional exporter package based on your provider. Each provider section below includes the specific installation command.
|
|
6
|
+
|
|
7
|
+
## Supported Providers
|
|
8
|
+
|
|
9
|
+
### Dash0
|
|
10
|
+
|
|
11
|
+
#### Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Dash0 uses gRPC protocol, requires both packages
|
|
15
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-grpc @grpc/grpc-js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
#### Configuration
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
22
|
+
import { Mastra } from '@mastra/core';
|
|
23
|
+
|
|
24
|
+
const mastra = new Mastra({
|
|
25
|
+
...,
|
|
26
|
+
observability: {
|
|
27
|
+
configs: {
|
|
28
|
+
otel: {
|
|
29
|
+
serviceName: 'mastra-service',
|
|
30
|
+
exporters: [
|
|
31
|
+
new OtelExporter({
|
|
32
|
+
provider: {
|
|
33
|
+
dash0: {
|
|
34
|
+
apiKey: process.env.DASH0_API_KEY, // Required at runtime
|
|
35
|
+
endpoint: 'ingress.us-west-2.aws.dash0.com:4317', // Required at runtime
|
|
36
|
+
dataset: 'production', // Optional: dataset name
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Note:** Get your endpoint from your Dash0 dashboard. It should be in the format `ingress.{region}.aws.dash0.com:4317`.
|
|
48
|
+
|
|
49
|
+
### SigNoz
|
|
50
|
+
|
|
51
|
+
#### Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-proto
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Configuration
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
61
|
+
import { Mastra } from '@mastra/core';
|
|
62
|
+
|
|
63
|
+
const mastra = new Mastra({
|
|
64
|
+
...,
|
|
65
|
+
observability: {
|
|
66
|
+
configs: {
|
|
67
|
+
otel: {
|
|
68
|
+
serviceName: 'mastra-service',
|
|
69
|
+
exporters: [
|
|
70
|
+
new OtelExporter({
|
|
71
|
+
provider: {
|
|
72
|
+
signoz: {
|
|
73
|
+
apiKey: process.env.SIGNOZ_API_KEY, // Required at runtime
|
|
74
|
+
region: 'us', // Optional: 'us' | 'eu' | 'in', defaults to 'us'
|
|
75
|
+
// endpoint: 'https://my-signoz.example.com', // Optional: for self-hosted
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### New Relic
|
|
87
|
+
|
|
88
|
+
#### Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-proto
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Configuration
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
98
|
+
import { Mastra } from '@mastra/core';
|
|
99
|
+
|
|
100
|
+
const mastra = new Mastra({
|
|
101
|
+
...,
|
|
102
|
+
observability: {
|
|
103
|
+
configs: {
|
|
104
|
+
otel: {
|
|
105
|
+
serviceName: 'mastra-service',
|
|
106
|
+
exporters: [
|
|
107
|
+
new OtelExporter({
|
|
108
|
+
provider: {
|
|
109
|
+
newrelic: {
|
|
110
|
+
apiKey: process.env.NEW_RELIC_LICENSE_KEY, // Required at runtime
|
|
111
|
+
// endpoint: 'https://otlp.eu01.nr-data.net', // Optional: for EU region
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Traceloop
|
|
123
|
+
|
|
124
|
+
#### Installation
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Traceloop uses HTTP/JSON protocol
|
|
128
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-http
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Configuration
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
135
|
+
import { Mastra } from '@mastra/core';
|
|
136
|
+
|
|
137
|
+
const mastra = new Mastra({
|
|
138
|
+
...,
|
|
139
|
+
observability: {
|
|
140
|
+
configs: {
|
|
141
|
+
otel: {
|
|
142
|
+
serviceName: 'mastra-service',
|
|
143
|
+
exporters: [
|
|
144
|
+
new OtelExporter({
|
|
145
|
+
provider: {
|
|
146
|
+
traceloop: {
|
|
147
|
+
apiKey: process.env.TRACELOOP_API_KEY, // Required at runtime
|
|
148
|
+
destinationId: 'my-destination', // Optional
|
|
149
|
+
// endpoint: 'https://custom.traceloop.com', // Optional
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Laminar
|
|
161
|
+
|
|
162
|
+
#### Installation
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-proto
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Configuration
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
172
|
+
import { Mastra } from '@mastra/core';
|
|
173
|
+
|
|
174
|
+
const mastra = new Mastra({
|
|
175
|
+
...,
|
|
176
|
+
observability: {
|
|
177
|
+
configs: {
|
|
178
|
+
otel: {
|
|
179
|
+
serviceName: 'mastra-service',
|
|
180
|
+
exporters: [
|
|
181
|
+
new OtelExporter({
|
|
182
|
+
provider: {
|
|
183
|
+
laminar: {
|
|
184
|
+
apiKey: process.env.LMNR_PROJECT_API_KEY, // Required at runtime
|
|
185
|
+
// teamId: process.env.LAMINAR_TEAM_ID, // Optional, for backwards compatibility
|
|
186
|
+
// endpoint: 'https://api.lmnr.ai/v1/traces', // Optional
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
})
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Note:** Laminar now only requires the `LMNR_PROJECT_API_KEY`. The `teamId` is optional.
|
|
198
|
+
|
|
199
|
+
### Zipkin
|
|
200
|
+
|
|
201
|
+
#### Installation
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-zipkin
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### Configuration
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
211
|
+
import { Mastra } from '@mastra/core';
|
|
212
|
+
|
|
213
|
+
const mastra = new Mastra({
|
|
214
|
+
...,
|
|
215
|
+
observability: {
|
|
216
|
+
configs: {
|
|
217
|
+
otel: {
|
|
218
|
+
serviceName: 'mastra-service',
|
|
219
|
+
exporters: [
|
|
220
|
+
new OtelExporter({
|
|
221
|
+
provider: {
|
|
222
|
+
custom: {
|
|
223
|
+
endpoint: 'http://localhost:9411/api/v2/spans',
|
|
224
|
+
protocol: 'zipkin',
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Custom/Other Providers
|
|
236
|
+
|
|
237
|
+
#### Installation
|
|
238
|
+
|
|
239
|
+
Choose the appropriate exporter based on your collector's protocol:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# For HTTP/JSON: Human-readable, larger payload, good for debugging
|
|
243
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-http
|
|
244
|
+
|
|
245
|
+
# For HTTP/Protobuf: Binary format, smaller payload, recommended for production
|
|
246
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-proto
|
|
247
|
+
|
|
248
|
+
# For gRPC: Bidirectional streaming, lowest latency, requires gRPC support
|
|
249
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-trace-otlp-grpc @grpc/grpc-js
|
|
250
|
+
|
|
251
|
+
# For Zipkin: Zipkin-specific format
|
|
252
|
+
npm install @mastra/otel-exporter @opentelemetry/exporter-zipkin
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Most providers recommend HTTP/Protobuf for production use.
|
|
256
|
+
|
|
257
|
+
#### Configuration
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
261
|
+
import { Mastra } from '@mastra/core';
|
|
262
|
+
|
|
263
|
+
const mastra = new Mastra({
|
|
264
|
+
...,
|
|
265
|
+
observability: {
|
|
266
|
+
configs: {
|
|
267
|
+
otel: {
|
|
268
|
+
serviceName: 'mastra-service',
|
|
269
|
+
exporters: [
|
|
270
|
+
new OtelExporter({
|
|
271
|
+
provider: {
|
|
272
|
+
custom: {
|
|
273
|
+
endpoint: 'https://your-collector.example.com/v1/traces', // Required at runtime
|
|
274
|
+
protocol: 'http/protobuf', // Optional: 'http/json' | 'http/protobuf' | 'grpc' | 'zipkin'
|
|
275
|
+
headers: { // Optional
|
|
276
|
+
'x-api-key': process.env.API_KEY,
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Why Separate Packages?
|
|
289
|
+
|
|
290
|
+
We've made exporter dependencies optional to:
|
|
291
|
+
|
|
292
|
+
- **Reduce bundle size** - Only include what you need
|
|
293
|
+
- **Faster installs** - Fewer dependencies to download
|
|
294
|
+
- **Avoid conflicts** - Some exporters have conflicting dependencies
|
|
295
|
+
|
|
296
|
+
If you forget to install the required exporter, you'll get a helpful error message telling you exactly what to install.
|
|
297
|
+
|
|
298
|
+
## Endpoint Configuration Notes
|
|
299
|
+
|
|
300
|
+
### Protocol Requirements
|
|
301
|
+
|
|
302
|
+
- **gRPC endpoints**: Automatically append `/v1/traces` to the base endpoint
|
|
303
|
+
- **HTTP endpoints**: Most providers expect `/v1/traces` or provider-specific paths
|
|
304
|
+
- **Authentication**:
|
|
305
|
+
- HTTP uses `headers` with standard HTTP headers
|
|
306
|
+
- gRPC uses lowercase metadata keys (e.g., `authorization` instead of `Authorization`)
|
|
307
|
+
|
|
308
|
+
### Provider-Specific Endpoints
|
|
309
|
+
|
|
310
|
+
| Provider | Protocol | Endpoint Format | Notes |
|
|
311
|
+
| --------- | ------------- | ---------------------------------------------------- | ------------------ |
|
|
312
|
+
| Dash0 | gRPC | `ingress.{region}.aws.dash0.com:4317` | Get from dashboard |
|
|
313
|
+
| SigNoz | HTTP/Protobuf | `https://ingest.{region}.signoz.cloud:443/v1/traces` | Cloud hosted |
|
|
314
|
+
| New Relic | HTTP/Protobuf | `https://otlp.nr-data.net:443/v1/traces` | US region |
|
|
315
|
+
| Traceloop | HTTP/JSON | `https://api.traceloop.com/v1/traces` | Default endpoint |
|
|
316
|
+
| Laminar | HTTP/Protobuf | `https://api.lmnr.ai/v1/traces` | Default endpoint |
|
|
317
|
+
|
|
318
|
+
## Additional configuration
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
// Main configuration interface
|
|
322
|
+
interface OtelExporterConfig {
|
|
323
|
+
// Provider configuration (discriminated union)
|
|
324
|
+
provider?: ProviderConfig;
|
|
325
|
+
|
|
326
|
+
// Export configuration
|
|
327
|
+
timeout?: number; // Export timeout in milliseconds (default: 30000)
|
|
328
|
+
batchSize?: number; // Max spans per batch (default: 512)
|
|
329
|
+
|
|
330
|
+
// Debug
|
|
331
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Batching Strategy
|
|
336
|
+
|
|
337
|
+
The OtelExporter uses OpenTelemetry's `BatchSpanProcessor` for efficient span export:
|
|
338
|
+
|
|
339
|
+
- **Automatic batching**: Spans are queued and exported in batches
|
|
340
|
+
- **Default batch size**: 512 spans (configurable via `batchSize`)
|
|
341
|
+
- **Export interval**: Every 5 seconds or when batch is full
|
|
342
|
+
- **Queue size**: Up to 2048 spans queued in memory
|
|
343
|
+
- **Production-ready**: Optimized for high-throughput applications
|
|
344
|
+
|
|
345
|
+
This approach ensures:
|
|
346
|
+
|
|
347
|
+
- Efficient network usage (fewer HTTP/gRPC calls)
|
|
348
|
+
- Better performance under load
|
|
349
|
+
- Automatic retry with backoff
|
|
350
|
+
- Proper trace context propagation across all spans in a trace
|
|
351
|
+
|
|
352
|
+
## OpenTelemetry Semantic Conventions
|
|
353
|
+
|
|
354
|
+
This exporter follows the [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) to ensure compatibility with observability platforms.
|
|
355
|
+
|
|
356
|
+
### Span Naming
|
|
357
|
+
|
|
358
|
+
Spans are named following OTEL conventions:
|
|
359
|
+
|
|
360
|
+
- **LLM Operations**: `chat {model}` or `tool_selection {model}`
|
|
361
|
+
- **Tool Execution**: `tool.execute {tool_name}`
|
|
362
|
+
- **Agent Runs**: `agent.{agent_id}`
|
|
363
|
+
- **Workflow Runs**: `workflow.{workflow_id}`
|
|
364
|
+
|
|
365
|
+
### Attributes
|
|
366
|
+
|
|
367
|
+
The exporter maps Mastra's AI tracing data to OTEL-compliant attributes:
|
|
368
|
+
|
|
369
|
+
#### Core Attributes
|
|
370
|
+
|
|
371
|
+
- `gen_ai.operation.name` - Operation type (chat, tool.execute, agent.run, workflow.run)
|
|
372
|
+
- `gen_ai.system` - AI provider (openai, anthropic, etc.)
|
|
373
|
+
- `gen_ai.request.model` - Model identifier
|
|
374
|
+
|
|
375
|
+
#### LLM-Specific Attributes
|
|
376
|
+
|
|
377
|
+
- `gen_ai.usage.input_tokens` - Number of input tokens
|
|
378
|
+
- `gen_ai.usage.output_tokens` - Number of output tokens
|
|
379
|
+
- `gen_ai.usage.total_tokens` - Total token count
|
|
380
|
+
- `gen_ai.request.temperature` - Sampling temperature
|
|
381
|
+
- `gen_ai.request.max_tokens` - Maximum tokens to generate
|
|
382
|
+
- `gen_ai.request.top_p` - Top-p sampling parameter
|
|
383
|
+
- `gen_ai.request.top_k` - Top-k sampling parameter
|
|
384
|
+
- `gen_ai.response.finish_reasons` - Reason for completion
|
|
385
|
+
- `gen_ai.prompt` - Input prompt (for LLM spans)
|
|
386
|
+
- `gen_ai.completion` - Model output (for LLM spans)
|
|
387
|
+
|
|
388
|
+
#### Tool Attributes
|
|
389
|
+
|
|
390
|
+
- `gen_ai.tool.name` - Tool identifier
|
|
391
|
+
- `gen_ai.tool.description` - Tool description
|
|
392
|
+
- `gen_ai.tool.success` - Whether tool execution succeeded
|
|
393
|
+
- `gen_ai.tool.input` - Tool input parameters
|
|
394
|
+
- `gen_ai.tool.output` - Tool execution result
|
|
395
|
+
|
|
396
|
+
#### Agent & Workflow Attributes
|
|
397
|
+
|
|
398
|
+
- `agent.id` - Agent identifier
|
|
399
|
+
- `agent.max_steps` - Maximum agent steps
|
|
400
|
+
- `workflow.id` - Workflow identifier
|
|
401
|
+
- `workflow.status` - Workflow execution status
|
|
402
|
+
|
|
403
|
+
#### Error Attributes
|
|
404
|
+
|
|
405
|
+
- `error` - Boolean indicating error occurred
|
|
406
|
+
- `error.type` - Error identifier
|
|
407
|
+
- `error.message` - Error description
|
|
408
|
+
- `error.domain` - Error domain/category
|
|
409
|
+
|
|
410
|
+
## Troubleshooting
|
|
411
|
+
|
|
412
|
+
### Missing Dependency Error
|
|
413
|
+
|
|
414
|
+
If you forget to install the required exporter package, you'll get a clear error message:
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
HTTP/Protobuf exporter is not installed (required for signoz).
|
|
418
|
+
To use HTTP/Protobuf export, install the required package:
|
|
419
|
+
|
|
420
|
+
npm install @opentelemetry/exporter-trace-otlp-proto
|
|
421
|
+
# or
|
|
422
|
+
pnpm add @opentelemetry/exporter-trace-otlp-proto
|
|
423
|
+
# or
|
|
424
|
+
yarn add @opentelemetry/exporter-trace-otlp-proto
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Common Issues
|
|
428
|
+
|
|
429
|
+
1. **Wrong exporter installed**: Make sure you installed the exporter matching your provider's protocol
|
|
430
|
+
2. **Multiple exporters needed**: If switching between providers, you may need multiple exporters installed
|
|
431
|
+
3. **Bundle size concerns**: Only install the exporters you actually use
|
|
432
|
+
|
|
433
|
+
## License
|
|
434
|
+
|
|
435
|
+
Apache 2.0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTelemetry AI Tracing Exporter for Mastra
|
|
3
|
+
*/
|
|
4
|
+
import type { AITracingExporter, AITracingEvent, TracingConfig } from '@mastra/core/ai-tracing';
|
|
5
|
+
import type { OtelExporterConfig } from './types.js';
|
|
6
|
+
export declare class OtelExporter implements AITracingExporter {
|
|
7
|
+
private config;
|
|
8
|
+
private tracingConfig?;
|
|
9
|
+
private spanConverter;
|
|
10
|
+
private processor?;
|
|
11
|
+
private exporter?;
|
|
12
|
+
private isSetup;
|
|
13
|
+
private isDisabled;
|
|
14
|
+
private logger;
|
|
15
|
+
name: string;
|
|
16
|
+
constructor(config: OtelExporterConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Initialize with tracing configuration
|
|
19
|
+
*/
|
|
20
|
+
init(config: TracingConfig): void;
|
|
21
|
+
private setupExporter;
|
|
22
|
+
exportEvent(event: AITracingEvent): Promise<void>;
|
|
23
|
+
private exportSpan;
|
|
24
|
+
shutdown(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ai-tracing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-tracing.d.ts","sourceRoot":"","sources":["../src/ai-tracing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAqB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiBnH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,qBAAa,YAAa,YAAW,iBAAiB;IACpD,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAC,CAAqB;IACvC,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,MAAM,CAAgB;IAE9B,IAAI,SAAmB;gBAEX,MAAM,EAAE,kBAAkB;IAWtC;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;YAInB,aAAa;IAiHrB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAgBzC,UAAU;IA8BlB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAMhC"}
|