@mastra/otel-exporter 1.0.23-alpha.2 → 1.1.0-alpha.4
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 +41 -0
- package/README.md +43 -3
- package/dist/index.cjs +478 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +477 -185
- package/dist/index.js.map +1 -1
- package/dist/loadExporter.d.ts +16 -1
- package/dist/loadExporter.d.ts.map +1 -1
- package/dist/log-converter.d.ts +33 -0
- package/dist/log-converter.d.ts.map +1 -0
- package/dist/provider-configs.d.ts +1 -1
- package/dist/provider-configs.d.ts.map +1 -1
- package/dist/tracing.d.ts +51 -10
- package/dist/tracing.d.ts.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +24 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @mastra/otel-exporter
|
|
2
2
|
|
|
3
|
+
## 1.1.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`7ad5585`](https://github.com/mastra-ai/mastra/commit/7ad55856406f1de398dc713f6a9eaa78b2784bb6), [`210ea7a`](https://github.com/mastra-ai/mastra/commit/210ea7af559791b73a44fc9c12179908aaa3183f), [`83218c8`](https://github.com/mastra-ai/mastra/commit/83218c88b37773c9424fbe733b37be556e55e94d), [`265ec9f`](https://github.com/mastra-ai/mastra/commit/265ec9f887b5c81255c873a76ff7796f16e4f99b), [`6ce80bf`](https://github.com/mastra-ai/mastra/commit/6ce80bf4872a891e0bddf8b80561a80584efb14b), [`9268531`](https://github.com/mastra-ai/mastra/commit/9268531e7ec4be98beeba3b3ae8be0a7ea380662), [`13ead79`](https://github.com/mastra-ai/mastra/commit/13ead79149486b88144db7e11e6ff551caef5be1), [`50f5884`](https://github.com/mastra-ai/mastra/commit/50f5884b412dc05924a4c306c05eef7fb95a4aa1), [`bd36d8e`](https://github.com/mastra-ai/mastra/commit/bd36d8eb6de8c9a0310352649dbd4b06703c2299), [`8ac9141`](https://github.com/mastra-ai/mastra/commit/8ac9141439caa8fdd674944c4d84f29b3c730296)]:
|
|
8
|
+
- @mastra/core@1.33.0-alpha.10
|
|
9
|
+
- @mastra/observability@1.12.0-alpha.3
|
|
10
|
+
|
|
11
|
+
## 1.1.0-alpha.3
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Added log export to `@mastra/otel-exporter`. Logs emitted on the Mastra observability bus are now forwarded to the configured OTLP endpoint alongside traces, using the same provider configuration. ([#13529](https://github.com/mastra-ai/mastra/pull/13529))
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
19
|
+
|
|
20
|
+
new OtelExporter({
|
|
21
|
+
provider: {
|
|
22
|
+
custom: { endpoint: 'http://localhost:4318', protocol: 'http/json' },
|
|
23
|
+
},
|
|
24
|
+
// signals.logs defaults to true; set to false to disable.
|
|
25
|
+
signals: { traces: true, logs: true },
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Requires the matching OTLP log exporter package to be installed (e.g. `@opentelemetry/exporter-logs-otlp-http` for HTTP/JSON, or `-proto` / `-grpc` variants).
|
|
30
|
+
|
|
31
|
+
**Trace correlation:** Logs that carry `traceId` and `spanId` are attached to the OTEL log record's native trace context, so backends like Datadog, Grafana, and Honeycomb auto-correlate logs to traces.
|
|
32
|
+
|
|
33
|
+
**Other improvements:**
|
|
34
|
+
- Trace and log endpoints are always normalized to a single signal-path suffix, so `http://host:4318/`, `http://host:4318`, and `http://host:4318/v1/traces/` all produce well-formed URLs instead of malformed variants like `//v1/logs`.
|
|
35
|
+
- Calling `flush()` or `shutdown()` immediately after init no longer drops telemetry — teardown waits for setup to finish before draining providers.
|
|
36
|
+
- Debug log output no longer exposes credential fragments. Provider header values are fully redacted instead of printing prefix/suffix slices.
|
|
37
|
+
- When a dynamically-loaded OTLP exporter package is installed but does not expose the expected named export, Mastra now disables that signal with a clear error message instead of failing later with an opaque "X is not a constructor" error.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [[`5688881`](https://github.com/mastra-ai/mastra/commit/5688881669c7ed157f31ac77f6fc5f8d95ceea32)]:
|
|
42
|
+
- @mastra/core@1.33.0-alpha.9
|
|
43
|
+
|
|
3
44
|
## 1.0.23-alpha.2
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
# OtelExporter - OpenTelemetry
|
|
1
|
+
# OtelExporter - OpenTelemetry Exporter
|
|
2
2
|
|
|
3
|
-
Export Mastra traces to any OpenTelemetry-compatible observability platform.
|
|
3
|
+
Export Mastra traces and logs to any OpenTelemetry-compatible observability platform.
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
+
## Signals
|
|
8
|
+
|
|
9
|
+
The exporter forwards two OpenTelemetry signals:
|
|
10
|
+
|
|
11
|
+
- **Traces** — Mastra spans, exported via `BatchSpanProcessor` over an OTLP `SpanExporter`.
|
|
12
|
+
- **Logs** — Mastra log events, exported via `BatchLogRecordProcessor` over an OTLP `LogRecordExporter`. When a log carries `traceId`/`spanId`, both the OTEL log record's native trace context and `mastra.traceId`/`mastra.spanId` attributes are populated so backends like Grafana, Datadog, and Honeycomb can correlate logs to traces automatically.
|
|
13
|
+
|
|
14
|
+
Both signals are enabled by default and share the same provider configuration. Toggle individual signals via `signals`:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
new OtelExporter({
|
|
18
|
+
provider: {
|
|
19
|
+
/* ... */
|
|
20
|
+
},
|
|
21
|
+
signals: {
|
|
22
|
+
traces: true, // default
|
|
23
|
+
logs: true, // default
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Log export requires the matching OTLP log exporter package for your protocol — install one of:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# HTTP/JSON
|
|
32
|
+
npm install @opentelemetry/exporter-logs-otlp-http
|
|
33
|
+
# HTTP/Protobuf
|
|
34
|
+
npm install @opentelemetry/exporter-logs-otlp-proto
|
|
35
|
+
# gRPC
|
|
36
|
+
npm install @opentelemetry/exporter-logs-otlp-grpc @grpc/grpc-js
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If the matching log exporter package is not installed, log export is silently disabled and traces continue to work.
|
|
40
|
+
|
|
7
41
|
## Environment Variables
|
|
8
42
|
|
|
9
43
|
All providers support zero-config setup via environment variables. Set the appropriate variables and the exporter will automatically use them:
|
|
@@ -397,7 +431,13 @@ interface OtelExporterConfig {
|
|
|
397
431
|
|
|
398
432
|
// Export configuration
|
|
399
433
|
timeout?: number; // Export timeout in milliseconds (default: 30000)
|
|
400
|
-
batchSize?: number; // Max spans per batch (default: 512)
|
|
434
|
+
batchSize?: number; // Max spans/logs per batch (default: 512)
|
|
435
|
+
|
|
436
|
+
// Per-signal toggles. All signals are enabled by default.
|
|
437
|
+
signals?: {
|
|
438
|
+
traces?: boolean;
|
|
439
|
+
logs?: boolean;
|
|
440
|
+
};
|
|
401
441
|
|
|
402
442
|
// Debug
|
|
403
443
|
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|