@mastra/otel-exporter 0.0.0-break-rename-vnext-legacy-20251002212351 → 0.0.0-bundle-recursion-20251030002519
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 +153 -4
- package/README.md +2 -2
- package/dist/ai-tracing.d.ts +6 -5
- package/dist/ai-tracing.d.ts.map +1 -1
- package/dist/index.cjs +75 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -64
- package/dist/index.js.map +1 -1
- package/dist/mastra-span.d.ts +1 -0
- package/dist/mastra-span.d.ts.map +1 -1
- package/dist/span-converter.d.ts.map +1 -1
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,162 @@
|
|
|
1
1
|
# @mastra/otel-exporter
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-bundle-recursion-20251030002519
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Rename LLM span types and attributes to use Model prefix ([#9105](https://github.com/mastra-ai/mastra/pull/9105))
|
|
8
|
+
|
|
9
|
+
BREAKING CHANGE: This release renames AI tracing span types and attribute interfaces to use the "Model" prefix instead of "LLM":
|
|
10
|
+
- `AISpanType.LLM_GENERATION` → `AISpanType.MODEL_GENERATION`
|
|
11
|
+
- `AISpanType.LLM_STEP` → `AISpanType.MODEL_STEP`
|
|
12
|
+
- `AISpanType.LLM_CHUNK` → `AISpanType.MODEL_CHUNK`
|
|
13
|
+
- `LLMGenerationAttributes` → `ModelGenerationAttributes`
|
|
14
|
+
- `LLMStepAttributes` → `ModelStepAttributes`
|
|
15
|
+
- `LLMChunkAttributes` → `ModelChunkAttributes`
|
|
16
|
+
- `InternalSpans.LLM` → `InternalSpans.MODEL`
|
|
17
|
+
|
|
18
|
+
This change better reflects that these span types apply to all AI models, not just Large Language Models.
|
|
19
|
+
|
|
20
|
+
Migration guide:
|
|
21
|
+
- Update all imports: `import { ModelGenerationAttributes } from '@mastra/core/ai-tracing'`
|
|
22
|
+
- Update span type references: `AISpanType.MODEL_GENERATION`
|
|
23
|
+
- Update InternalSpans usage: `InternalSpans.MODEL`
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Fixed import isssues in exporters. ([#9316](https://github.com/mastra-ai/mastra/pull/9316))
|
|
28
|
+
|
|
29
|
+
- Update peer dependencies to match core package version bump (1.0.0) ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
|
|
32
|
+
- @mastra/core@0.0.0-bundle-recursion-20251030002519
|
|
33
|
+
|
|
34
|
+
## 0.2.0
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- feat(otel-exporter): Add customizable 'exporter' constructor parameter ([#8827](https://github.com/mastra-ai/mastra/pull/8827))
|
|
39
|
+
|
|
40
|
+
You can now pass in an instantiated `TraceExporter` inheriting class into `OtelExporter`.
|
|
41
|
+
This will circumvent the default package detection, no longer instantiating a `TraceExporter`
|
|
42
|
+
automatically if one is instead passed in to the `OtelExporter` constructor.
|
|
43
|
+
|
|
44
|
+
feat(arize): Initial release of @mastra/arize observability package
|
|
45
|
+
|
|
46
|
+
The `@mastra/arize` package exports an `ArizeExporter` class that can be used to easily send AI
|
|
47
|
+
traces from Mastra to Arize AX, Arize Phoenix, or any OpenInference compatible collector.
|
|
48
|
+
It sends traces uses `BatchSpanProcessor` over OTLP connections.
|
|
49
|
+
It leverages the `@mastra/otel-exporter` package, reusing `OtelExporter` for transmission and
|
|
50
|
+
span management.
|
|
51
|
+
See the README in `observability/arize/README.md` for more details
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- fix(observability): Add ParentSpanContext to MastraSpan's with parentage ([#9085](https://github.com/mastra-ai/mastra/pull/9085))
|
|
56
|
+
|
|
57
|
+
- Update peerdeps to 0.23.0-0 ([#9043](https://github.com/mastra-ai/mastra/pull/9043))
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [[`c67ca32`](https://github.com/mastra-ai/mastra/commit/c67ca32e3c2cf69bfc146580770c720220ca44ac), [`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec), [`dbc9e12`](https://github.com/mastra-ai/mastra/commit/dbc9e1216ba575ba59ead4afb727a01215f7de4f), [`99e41b9`](https://github.com/mastra-ai/mastra/commit/99e41b94957cdd25137d3ac12e94e8b21aa01b68), [`c28833c`](https://github.com/mastra-ai/mastra/commit/c28833c5b6d8e10eeffd7f7d39129d53b8bca240), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`ba201b8`](https://github.com/mastra-ai/mastra/commit/ba201b8f8feac4c72350f2dbd52c13c7297ba7b0), [`f053e89`](https://github.com/mastra-ai/mastra/commit/f053e89160dbd0bd3333fc3492f68231b5c7c349), [`4fc4136`](https://github.com/mastra-ai/mastra/commit/4fc413652866a8d2240694fddb2562e9edbb70df), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`d10baf5`](https://github.com/mastra-ai/mastra/commit/d10baf5a3c924f2a6654e23a3e318ed03f189b76), [`038c55a`](https://github.com/mastra-ai/mastra/commit/038c55a7090fc1b1513a966386d3072617f836ac), [`182f045`](https://github.com/mastra-ai/mastra/commit/182f0458f25bd70aa774e64fd923c8a483eddbf1), [`9a1a485`](https://github.com/mastra-ai/mastra/commit/9a1a4859b855e37239f652bf14b1ecd1029b8c4e), [`9257233`](https://github.com/mastra-ai/mastra/commit/9257233c4ffce09b2bedc2a9adbd70d7a83fa8e2), [`7620d2b`](https://github.com/mastra-ai/mastra/commit/7620d2bddeb4fae4c3c0a0b4e672969795fca11a), [`b2365f0`](https://github.com/mastra-ai/mastra/commit/b2365f038dd4c5f06400428b224af963f399ad50), [`0f1a4c9`](https://github.com/mastra-ai/mastra/commit/0f1a4c984fb4b104b2f0b63ba18c9fa77f567700), [`9029ba3`](https://github.com/mastra-ai/mastra/commit/9029ba34459c8859fed4c6b73efd8e2d0021e7ba), [`426cc56`](https://github.com/mastra-ai/mastra/commit/426cc561c85ae76a112ded2385532a91f9f9f074), [`00931fb`](https://github.com/mastra-ai/mastra/commit/00931fb1a21aa42c4fbc20c2c40dd62466b8fc8f), [`e473bfe`](https://github.com/mastra-ai/mastra/commit/e473bfe416c0b8e876973c2b6a6f13c394b7a93f), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`2db6160`](https://github.com/mastra-ai/mastra/commit/2db6160e2022ff8827c15d30157e684683b934b5), [`8aeea37`](https://github.com/mastra-ai/mastra/commit/8aeea37efdde347c635a67fed56794943b7f74ec), [`02fe153`](https://github.com/mastra-ai/mastra/commit/02fe15351d6021d214da48ec982a0e9e4150bcee), [`648e2ca`](https://github.com/mastra-ai/mastra/commit/648e2ca42da54838c6ccbdaadc6fadd808fa6b86), [`74567b3`](https://github.com/mastra-ai/mastra/commit/74567b3d237ae3915cd0bca3cf55fa0a64e4e4a4), [`b65c5e0`](https://github.com/mastra-ai/mastra/commit/b65c5e0fe6f3c390a9a8bbcf69304d972c3a4afb), [`15a1733`](https://github.com/mastra-ai/mastra/commit/15a1733074cee8bd37370e1af34cd818e89fa7ac), [`fc2a774`](https://github.com/mastra-ai/mastra/commit/fc2a77468981aaddc3e77f83f0c4ad4a4af140da), [`4e08933`](https://github.com/mastra-ai/mastra/commit/4e08933625464dfde178347af5b6278fcf34188e)]:
|
|
60
|
+
- @mastra/core@0.22.0
|
|
61
|
+
|
|
62
|
+
## 0.2.0-alpha.0
|
|
63
|
+
|
|
64
|
+
### Minor Changes
|
|
65
|
+
|
|
66
|
+
- feat(otel-exporter): Add customizable 'exporter' constructor parameter ([#8827](https://github.com/mastra-ai/mastra/pull/8827))
|
|
67
|
+
|
|
68
|
+
You can now pass in an instantiated `TraceExporter` inheriting class into `OtelExporter`.
|
|
69
|
+
This will circumvent the default package detection, no longer instantiating a `TraceExporter`
|
|
70
|
+
automatically if one is instead passed in to the `OtelExporter` constructor.
|
|
71
|
+
|
|
72
|
+
feat(arize): Initial release of @mastra/arize observability package
|
|
73
|
+
|
|
74
|
+
The `@mastra/arize` package exports an `ArizeExporter` class that can be used to easily send AI
|
|
75
|
+
traces from Mastra to Arize AX, Arize Phoenix, or any OpenInference compatible collector.
|
|
76
|
+
It sends traces uses `BatchSpanProcessor` over OTLP connections.
|
|
77
|
+
It leverages the `@mastra/otel-exporter` package, reusing `OtelExporter` for transmission and
|
|
78
|
+
span management.
|
|
79
|
+
See the README in `observability/arize/README.md` for more details
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- fix(observability): Add ParentSpanContext to MastraSpan's with parentage ([#9085](https://github.com/mastra-ai/mastra/pull/9085))
|
|
84
|
+
|
|
85
|
+
- Update peerdeps to 0.23.0-0 ([#9043](https://github.com/mastra-ai/mastra/pull/9043))
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [[`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`ba201b8`](https://github.com/mastra-ai/mastra/commit/ba201b8f8feac4c72350f2dbd52c13c7297ba7b0), [`4fc4136`](https://github.com/mastra-ai/mastra/commit/4fc413652866a8d2240694fddb2562e9edbb70df), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`d10baf5`](https://github.com/mastra-ai/mastra/commit/d10baf5a3c924f2a6654e23a3e318ed03f189b76), [`038c55a`](https://github.com/mastra-ai/mastra/commit/038c55a7090fc1b1513a966386d3072617f836ac), [`182f045`](https://github.com/mastra-ai/mastra/commit/182f0458f25bd70aa774e64fd923c8a483eddbf1), [`7620d2b`](https://github.com/mastra-ai/mastra/commit/7620d2bddeb4fae4c3c0a0b4e672969795fca11a), [`b2365f0`](https://github.com/mastra-ai/mastra/commit/b2365f038dd4c5f06400428b224af963f399ad50), [`9029ba3`](https://github.com/mastra-ai/mastra/commit/9029ba34459c8859fed4c6b73efd8e2d0021e7ba), [`426cc56`](https://github.com/mastra-ai/mastra/commit/426cc561c85ae76a112ded2385532a91f9f9f074), [`00931fb`](https://github.com/mastra-ai/mastra/commit/00931fb1a21aa42c4fbc20c2c40dd62466b8fc8f), [`e473bfe`](https://github.com/mastra-ai/mastra/commit/e473bfe416c0b8e876973c2b6a6f13c394b7a93f), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`648e2ca`](https://github.com/mastra-ai/mastra/commit/648e2ca42da54838c6ccbdaadc6fadd808fa6b86), [`b65c5e0`](https://github.com/mastra-ai/mastra/commit/b65c5e0fe6f3c390a9a8bbcf69304d972c3a4afb)]:
|
|
88
|
+
- @mastra/core@0.22.0-alpha.1
|
|
89
|
+
|
|
90
|
+
## 0.1.0
|
|
91
|
+
|
|
92
|
+
### Minor Changes
|
|
93
|
+
|
|
94
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8623](https://github.com/mastra-ai/mastra/pull/8623))
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8619](https://github.com/mastra-ai/mastra/pull/8619))
|
|
99
|
+
|
|
100
|
+
- Added tracing of input & output processors (this includes using structuredOutput) ([#8623](https://github.com/mastra-ai/mastra/pull/8623))
|
|
101
|
+
|
|
102
|
+
- Add `resourceAttributes` to `OtelExporterConfig` so that attributes like `deployment.environment` can be set in the new OpenTelemetry exporter. ([#8700](https://github.com/mastra-ai/mastra/pull/8700))
|
|
103
|
+
|
|
104
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8557](https://github.com/mastra-ai/mastra/pull/8557))
|
|
105
|
+
|
|
106
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8626](https://github.com/mastra-ai/mastra/pull/8626))
|
|
107
|
+
|
|
108
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8686](https://github.com/mastra-ai/mastra/pull/8686))
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [[`1ed9670`](https://github.com/mastra-ai/mastra/commit/1ed9670d3ca50cb60dc2e517738c5eef3968ed27), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`f59fc1e`](https://github.com/mastra-ai/mastra/commit/f59fc1e406b8912e692f6bff6cfd4754cc8d165c), [`158381d`](https://github.com/mastra-ai/mastra/commit/158381d39335be934b81ef8a1947bccace492c25), [`a1799bc`](https://github.com/mastra-ai/mastra/commit/a1799bcc1b5a1cdc188f2ac0165f17a1c4ac6f7b), [`6ff6094`](https://github.com/mastra-ai/mastra/commit/6ff60946f4ecfebdeef6e21d2b230c2204f2c9b8), [`fb703b9`](https://github.com/mastra-ai/mastra/commit/fb703b9634eeaff1a6eb2b5531ce0f9e8fb04727), [`37a2314`](https://github.com/mastra-ai/mastra/commit/37a23148e0e5a3b40d4f9f098b194671a8a49faf), [`7b1ef57`](https://github.com/mastra-ai/mastra/commit/7b1ef57fc071c2aa2a2e32905b18cd88719c5a39), [`05a9dee`](https://github.com/mastra-ai/mastra/commit/05a9dee3d355694d28847bfffb6289657fcf7dfa), [`e3c1077`](https://github.com/mastra-ai/mastra/commit/e3c107763aedd1643d3def5df450c235da9ff76c), [`1908ca0`](https://github.com/mastra-ai/mastra/commit/1908ca0521f90e43779cc29ab590173ca560443c), [`1bccdb3`](https://github.com/mastra-ai/mastra/commit/1bccdb33eb90cbeba2dc5ece1c2561fb774b26b6), [`5ef944a`](https://github.com/mastra-ai/mastra/commit/5ef944a3721d93105675cac2b2311432ff8cc393), [`d6b186f`](https://github.com/mastra-ai/mastra/commit/d6b186fb08f1caf1b86f73d3a5ee88fb999ca3be), [`ee68e82`](https://github.com/mastra-ai/mastra/commit/ee68e8289ea4408d29849e899bc6e78b3bd4e843), [`228228b`](https://github.com/mastra-ai/mastra/commit/228228b0b1de9291cb8887587f5cea1a8757ebad), [`ea33930`](https://github.com/mastra-ai/mastra/commit/ea339301e82d6318257720d811b043014ee44064), [`65493b3`](https://github.com/mastra-ai/mastra/commit/65493b31c36f6fdb78f9679f7e1ecf0c250aa5ee), [`a998b8f`](https://github.com/mastra-ai/mastra/commit/a998b8f858091c2ec47683e60766cf12d03001e4), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`8a37bdd`](https://github.com/mastra-ai/mastra/commit/8a37bddb6d8614a32c5b70303d583d80c620ea61), [`135d6f2`](https://github.com/mastra-ai/mastra/commit/135d6f22a326ed1dffff858700669dff09d2c9eb)]:
|
|
111
|
+
- @mastra/core@0.21.0
|
|
112
|
+
|
|
113
|
+
## 0.1.0-alpha.1
|
|
114
|
+
|
|
115
|
+
### Minor Changes
|
|
116
|
+
|
|
117
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8623](https://github.com/mastra-ai/mastra/pull/8623))
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Added tracing of input & output processors (this includes using structuredOutput) ([#8623](https://github.com/mastra-ai/mastra/pull/8623))
|
|
122
|
+
|
|
123
|
+
- Add `resourceAttributes` to `OtelExporterConfig` so that attributes like `deployment.environment` can be set in the new OpenTelemetry exporter. ([#8700](https://github.com/mastra-ai/mastra/pull/8700))
|
|
124
|
+
|
|
125
|
+
- Updated dependencies [[`1ed9670`](https://github.com/mastra-ai/mastra/commit/1ed9670d3ca50cb60dc2e517738c5eef3968ed27), [`158381d`](https://github.com/mastra-ai/mastra/commit/158381d39335be934b81ef8a1947bccace492c25), [`fb703b9`](https://github.com/mastra-ai/mastra/commit/fb703b9634eeaff1a6eb2b5531ce0f9e8fb04727), [`37a2314`](https://github.com/mastra-ai/mastra/commit/37a23148e0e5a3b40d4f9f098b194671a8a49faf), [`05a9dee`](https://github.com/mastra-ai/mastra/commit/05a9dee3d355694d28847bfffb6289657fcf7dfa), [`e3c1077`](https://github.com/mastra-ai/mastra/commit/e3c107763aedd1643d3def5df450c235da9ff76c), [`1bccdb3`](https://github.com/mastra-ai/mastra/commit/1bccdb33eb90cbeba2dc5ece1c2561fb774b26b6), [`5ef944a`](https://github.com/mastra-ai/mastra/commit/5ef944a3721d93105675cac2b2311432ff8cc393), [`d6b186f`](https://github.com/mastra-ai/mastra/commit/d6b186fb08f1caf1b86f73d3a5ee88fb999ca3be), [`65493b3`](https://github.com/mastra-ai/mastra/commit/65493b31c36f6fdb78f9679f7e1ecf0c250aa5ee), [`a998b8f`](https://github.com/mastra-ai/mastra/commit/a998b8f858091c2ec47683e60766cf12d03001e4), [`8a37bdd`](https://github.com/mastra-ai/mastra/commit/8a37bddb6d8614a32c5b70303d583d80c620ea61)]:
|
|
126
|
+
- @mastra/core@0.21.0-alpha.1
|
|
127
|
+
|
|
128
|
+
## 0.0.4-alpha.0
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8619](https://github.com/mastra-ai/mastra/pull/8619))
|
|
133
|
+
|
|
134
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8557](https://github.com/mastra-ai/mastra/pull/8557))
|
|
135
|
+
|
|
136
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8626](https://github.com/mastra-ai/mastra/pull/8626))
|
|
137
|
+
|
|
138
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8686](https://github.com/mastra-ai/mastra/pull/8686))
|
|
139
|
+
|
|
140
|
+
- Updated dependencies [[`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`7b1ef57`](https://github.com/mastra-ai/mastra/commit/7b1ef57fc071c2aa2a2e32905b18cd88719c5a39), [`ee68e82`](https://github.com/mastra-ai/mastra/commit/ee68e8289ea4408d29849e899bc6e78b3bd4e843), [`228228b`](https://github.com/mastra-ai/mastra/commit/228228b0b1de9291cb8887587f5cea1a8757ebad), [`ea33930`](https://github.com/mastra-ai/mastra/commit/ea339301e82d6318257720d811b043014ee44064), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`135d6f2`](https://github.com/mastra-ai/mastra/commit/135d6f22a326ed1dffff858700669dff09d2c9eb), [`59d036d`](https://github.com/mastra-ai/mastra/commit/59d036d4c2706b430b0e3f1f1e0ee853ce16ca04)]:
|
|
141
|
+
- @mastra/core@0.21.0-alpha.0
|
|
142
|
+
|
|
143
|
+
## 0.0.3
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
|
|
148
|
+
|
|
149
|
+
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
|
|
150
|
+
- @mastra/core@0.20.0
|
|
151
|
+
|
|
152
|
+
## 0.0.3-alpha.0
|
|
4
153
|
|
|
5
154
|
### Patch Changes
|
|
6
155
|
|
|
7
|
-
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([
|
|
156
|
+
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
|
|
8
157
|
|
|
9
|
-
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`
|
|
10
|
-
- @mastra/core@0.0.0
|
|
158
|
+
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
|
|
159
|
+
- @mastra/core@0.20.0-alpha.0
|
|
11
160
|
|
|
12
161
|
## 0.0.2
|
|
13
162
|
|
package/README.md
CHANGED
|
@@ -382,8 +382,8 @@ The exporter maps Mastra's AI tracing data to OTEL-compliant attributes:
|
|
|
382
382
|
- `gen_ai.request.top_p` - Top-p sampling parameter
|
|
383
383
|
- `gen_ai.request.top_k` - Top-k sampling parameter
|
|
384
384
|
- `gen_ai.response.finish_reasons` - Reason for completion
|
|
385
|
-
- `gen_ai.prompt` - Input prompt (for
|
|
386
|
-
- `gen_ai.completion` - Model output (for
|
|
385
|
+
- `gen_ai.prompt` - Input prompt (for Model spans)
|
|
386
|
+
- `gen_ai.completion` - Model output (for Model spans)
|
|
387
387
|
|
|
388
388
|
#### Tool Attributes
|
|
389
389
|
|
package/dist/ai-tracing.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenTelemetry AI Tracing Exporter for Mastra
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { AITracingEvent, TracingConfig } from '@mastra/core/ai-tracing';
|
|
5
|
+
import { BaseExporter } from '@mastra/core/ai-tracing';
|
|
5
6
|
import type { OtelExporterConfig } from './types.js';
|
|
6
|
-
export declare class OtelExporter
|
|
7
|
+
export declare class OtelExporter extends BaseExporter {
|
|
7
8
|
private config;
|
|
8
9
|
private tracingConfig?;
|
|
9
10
|
private spanConverter;
|
|
10
11
|
private processor?;
|
|
11
12
|
private exporter?;
|
|
12
13
|
private isSetup;
|
|
13
|
-
private isDisabled;
|
|
14
|
-
private logger;
|
|
15
14
|
name: string;
|
|
16
15
|
constructor(config: OtelExporterConfig);
|
|
17
16
|
/**
|
|
@@ -19,7 +18,9 @@ export declare class OtelExporter implements AITracingExporter {
|
|
|
19
18
|
*/
|
|
20
19
|
init(config: TracingConfig): void;
|
|
21
20
|
private setupExporter;
|
|
22
|
-
|
|
21
|
+
private setupProcessor;
|
|
22
|
+
private setup;
|
|
23
|
+
protected _exportEvent(event: AITracingEvent): Promise<void>;
|
|
23
24
|
private exportSpan;
|
|
24
25
|
shutdown(): Promise<void>;
|
|
25
26
|
}
|
package/dist/ai-tracing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tracing.d.ts","sourceRoot":"","sources":["../src/ai-tracing.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"ai-tracing.d.ts","sourceRoot":"","sources":["../src/ai-tracing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAqB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAsB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAgB3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,qBAAa,YAAa,SAAQ,YAAY;IAC5C,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;IAEjC,IAAI,SAAmB;gBAEX,MAAM,EAAE,kBAAkB;IAYtC;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;YAInB,aAAa;YA6Fb,cAAc;YAqCd,KAAK;cAOH,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAWpD,UAAU;IA8BlB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAMhC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var aiTracing = require('@mastra/core/ai-tracing');
|
|
4
|
-
var logger = require('@mastra/core/logger');
|
|
5
4
|
var api = require('@opentelemetry/api');
|
|
6
5
|
var resources = require('@opentelemetry/resources');
|
|
7
6
|
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
@@ -209,6 +208,7 @@ var MastraReadableSpan = class {
|
|
|
209
208
|
name;
|
|
210
209
|
kind;
|
|
211
210
|
spanContext;
|
|
211
|
+
parentSpanContext;
|
|
212
212
|
parentSpanId;
|
|
213
213
|
startTime;
|
|
214
214
|
endTime;
|
|
@@ -276,6 +276,14 @@ var MastraReadableSpan = class {
|
|
|
276
276
|
traceFlags: api.TraceFlags.SAMPLED,
|
|
277
277
|
isRemote: false
|
|
278
278
|
});
|
|
279
|
+
if (parentSpanId) {
|
|
280
|
+
this.parentSpanContext = {
|
|
281
|
+
traceId: aiSpan.traceId,
|
|
282
|
+
spanId: parentSpanId,
|
|
283
|
+
traceFlags: api.TraceFlags.SAMPLED,
|
|
284
|
+
isRemote: false
|
|
285
|
+
};
|
|
286
|
+
}
|
|
279
287
|
this.resource = resource || {};
|
|
280
288
|
this.instrumentationLibrary = instrumentationLibrary || {
|
|
281
289
|
name: "@mastra/otel",
|
|
@@ -296,24 +304,14 @@ var MastraReadableSpan = class {
|
|
|
296
304
|
|
|
297
305
|
// src/span-converter.ts
|
|
298
306
|
var SPAN_KIND_MAPPING = {
|
|
299
|
-
//
|
|
300
|
-
[aiTracing.AISpanType.
|
|
301
|
-
[aiTracing.AISpanType.
|
|
302
|
-
//
|
|
303
|
-
[aiTracing.AISpanType.TOOL_CALL]: api.SpanKind.INTERNAL,
|
|
307
|
+
// Model operations are CLIENT spans (calling external AI services)
|
|
308
|
+
[aiTracing.AISpanType.MODEL_GENERATION]: api.SpanKind.CLIENT,
|
|
309
|
+
[aiTracing.AISpanType.MODEL_CHUNK]: api.SpanKind.CLIENT,
|
|
310
|
+
// MCP tool calls are CLIENT (external service calls)
|
|
304
311
|
[aiTracing.AISpanType.MCP_TOOL_CALL]: api.SpanKind.CLIENT,
|
|
305
312
|
// Root spans for agent/workflow are SERVER (entry points)
|
|
306
313
|
[aiTracing.AISpanType.AGENT_RUN]: api.SpanKind.SERVER,
|
|
307
|
-
[aiTracing.AISpanType.WORKFLOW_RUN]: api.SpanKind.SERVER
|
|
308
|
-
// Internal workflow operations
|
|
309
|
-
[aiTracing.AISpanType.WORKFLOW_STEP]: api.SpanKind.INTERNAL,
|
|
310
|
-
[aiTracing.AISpanType.WORKFLOW_LOOP]: api.SpanKind.INTERNAL,
|
|
311
|
-
[aiTracing.AISpanType.WORKFLOW_PARALLEL]: api.SpanKind.INTERNAL,
|
|
312
|
-
[aiTracing.AISpanType.WORKFLOW_CONDITIONAL]: api.SpanKind.INTERNAL,
|
|
313
|
-
[aiTracing.AISpanType.WORKFLOW_CONDITIONAL_EVAL]: api.SpanKind.INTERNAL,
|
|
314
|
-
[aiTracing.AISpanType.WORKFLOW_SLEEP]: api.SpanKind.INTERNAL,
|
|
315
|
-
[aiTracing.AISpanType.WORKFLOW_WAIT_EVENT]: api.SpanKind.INTERNAL,
|
|
316
|
-
[aiTracing.AISpanType.GENERIC]: api.SpanKind.INTERNAL
|
|
314
|
+
[aiTracing.AISpanType.WORKFLOW_RUN]: api.SpanKind.SERVER
|
|
317
315
|
};
|
|
318
316
|
var SpanConverter = class {
|
|
319
317
|
resource;
|
|
@@ -360,7 +358,7 @@ var SpanConverter = class {
|
|
|
360
358
|
*/
|
|
361
359
|
buildSpanName(aiSpan) {
|
|
362
360
|
switch (aiSpan.type) {
|
|
363
|
-
case aiTracing.AISpanType.
|
|
361
|
+
case aiTracing.AISpanType.MODEL_GENERATION: {
|
|
364
362
|
const attrs = aiSpan.attributes;
|
|
365
363
|
const operation = attrs?.resultType === "tool_selection" ? "tool_selection" : "chat";
|
|
366
364
|
const model = attrs?.model || "unknown";
|
|
@@ -405,7 +403,7 @@ var SpanConverter = class {
|
|
|
405
403
|
if (aiSpan.input !== void 0) {
|
|
406
404
|
const inputStr = typeof aiSpan.input === "string" ? aiSpan.input : JSON.stringify(aiSpan.input);
|
|
407
405
|
attributes["input"] = inputStr;
|
|
408
|
-
if (aiSpan.type === aiTracing.AISpanType.
|
|
406
|
+
if (aiSpan.type === aiTracing.AISpanType.MODEL_GENERATION) {
|
|
409
407
|
attributes["gen_ai.prompt"] = inputStr;
|
|
410
408
|
} else if (aiSpan.type === aiTracing.AISpanType.TOOL_CALL || aiSpan.type === aiTracing.AISpanType.MCP_TOOL_CALL) {
|
|
411
409
|
attributes["gen_ai.tool.input"] = inputStr;
|
|
@@ -414,64 +412,64 @@ var SpanConverter = class {
|
|
|
414
412
|
if (aiSpan.output !== void 0) {
|
|
415
413
|
const outputStr = typeof aiSpan.output === "string" ? aiSpan.output : JSON.stringify(aiSpan.output);
|
|
416
414
|
attributes["output"] = outputStr;
|
|
417
|
-
if (aiSpan.type === aiTracing.AISpanType.
|
|
415
|
+
if (aiSpan.type === aiTracing.AISpanType.MODEL_GENERATION) {
|
|
418
416
|
attributes["gen_ai.completion"] = outputStr;
|
|
419
417
|
} else if (aiSpan.type === aiTracing.AISpanType.TOOL_CALL || aiSpan.type === aiTracing.AISpanType.MCP_TOOL_CALL) {
|
|
420
418
|
attributes["gen_ai.tool.output"] = outputStr;
|
|
421
419
|
}
|
|
422
420
|
}
|
|
423
|
-
if (aiSpan.type === aiTracing.AISpanType.
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
attributes["gen_ai.request.model"] =
|
|
421
|
+
if (aiSpan.type === aiTracing.AISpanType.MODEL_GENERATION && aiSpan.attributes) {
|
|
422
|
+
const modelAttrs = aiSpan.attributes;
|
|
423
|
+
if (modelAttrs.model) {
|
|
424
|
+
attributes["gen_ai.request.model"] = modelAttrs.model;
|
|
427
425
|
}
|
|
428
|
-
if (
|
|
429
|
-
attributes["gen_ai.system"] =
|
|
426
|
+
if (modelAttrs.provider) {
|
|
427
|
+
attributes["gen_ai.system"] = modelAttrs.provider;
|
|
430
428
|
}
|
|
431
|
-
if (
|
|
432
|
-
const inputTokens =
|
|
433
|
-
const outputTokens =
|
|
429
|
+
if (modelAttrs.usage) {
|
|
430
|
+
const inputTokens = modelAttrs.usage.inputTokens ?? modelAttrs.usage.promptTokens;
|
|
431
|
+
const outputTokens = modelAttrs.usage.outputTokens ?? modelAttrs.usage.completionTokens;
|
|
434
432
|
if (inputTokens !== void 0) {
|
|
435
433
|
attributes["gen_ai.usage.input_tokens"] = inputTokens;
|
|
436
434
|
}
|
|
437
435
|
if (outputTokens !== void 0) {
|
|
438
436
|
attributes["gen_ai.usage.output_tokens"] = outputTokens;
|
|
439
437
|
}
|
|
440
|
-
if (
|
|
441
|
-
attributes["gen_ai.usage.total_tokens"] =
|
|
438
|
+
if (modelAttrs.usage.totalTokens !== void 0) {
|
|
439
|
+
attributes["gen_ai.usage.total_tokens"] = modelAttrs.usage.totalTokens;
|
|
442
440
|
}
|
|
443
|
-
if (
|
|
444
|
-
attributes["gen_ai.usage.reasoning_tokens"] =
|
|
441
|
+
if (modelAttrs.usage.reasoningTokens !== void 0) {
|
|
442
|
+
attributes["gen_ai.usage.reasoning_tokens"] = modelAttrs.usage.reasoningTokens;
|
|
445
443
|
}
|
|
446
|
-
if (
|
|
447
|
-
attributes["gen_ai.usage.cached_input_tokens"] =
|
|
444
|
+
if (modelAttrs.usage.cachedInputTokens !== void 0) {
|
|
445
|
+
attributes["gen_ai.usage.cached_input_tokens"] = modelAttrs.usage.cachedInputTokens;
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
|
-
if (
|
|
451
|
-
if (
|
|
452
|
-
attributes["gen_ai.request.temperature"] =
|
|
448
|
+
if (modelAttrs.parameters) {
|
|
449
|
+
if (modelAttrs.parameters.temperature !== void 0) {
|
|
450
|
+
attributes["gen_ai.request.temperature"] = modelAttrs.parameters.temperature;
|
|
453
451
|
}
|
|
454
|
-
if (
|
|
455
|
-
attributes["gen_ai.request.max_tokens"] =
|
|
452
|
+
if (modelAttrs.parameters.maxOutputTokens !== void 0) {
|
|
453
|
+
attributes["gen_ai.request.max_tokens"] = modelAttrs.parameters.maxOutputTokens;
|
|
456
454
|
}
|
|
457
|
-
if (
|
|
458
|
-
attributes["gen_ai.request.top_p"] =
|
|
455
|
+
if (modelAttrs.parameters.topP !== void 0) {
|
|
456
|
+
attributes["gen_ai.request.top_p"] = modelAttrs.parameters.topP;
|
|
459
457
|
}
|
|
460
|
-
if (
|
|
461
|
-
attributes["gen_ai.request.top_k"] =
|
|
458
|
+
if (modelAttrs.parameters.topK !== void 0) {
|
|
459
|
+
attributes["gen_ai.request.top_k"] = modelAttrs.parameters.topK;
|
|
462
460
|
}
|
|
463
|
-
if (
|
|
464
|
-
attributes["gen_ai.request.presence_penalty"] =
|
|
461
|
+
if (modelAttrs.parameters.presencePenalty !== void 0) {
|
|
462
|
+
attributes["gen_ai.request.presence_penalty"] = modelAttrs.parameters.presencePenalty;
|
|
465
463
|
}
|
|
466
|
-
if (
|
|
467
|
-
attributes["gen_ai.request.frequency_penalty"] =
|
|
464
|
+
if (modelAttrs.parameters.frequencyPenalty !== void 0) {
|
|
465
|
+
attributes["gen_ai.request.frequency_penalty"] = modelAttrs.parameters.frequencyPenalty;
|
|
468
466
|
}
|
|
469
|
-
if (
|
|
470
|
-
attributes["gen_ai.request.stop_sequences"] = JSON.stringify(
|
|
467
|
+
if (modelAttrs.parameters.stopSequences) {
|
|
468
|
+
attributes["gen_ai.request.stop_sequences"] = JSON.stringify(modelAttrs.parameters.stopSequences);
|
|
471
469
|
}
|
|
472
470
|
}
|
|
473
|
-
if (
|
|
474
|
-
attributes["gen_ai.response.finish_reasons"] =
|
|
471
|
+
if (modelAttrs.finishReason) {
|
|
472
|
+
attributes["gen_ai.response.finish_reasons"] = modelAttrs.finishReason;
|
|
475
473
|
}
|
|
476
474
|
}
|
|
477
475
|
if ((aiSpan.type === aiTracing.AISpanType.TOOL_CALL || aiSpan.type === aiTracing.AISpanType.MCP_TOOL_CALL) && aiSpan.attributes) {
|
|
@@ -500,6 +498,7 @@ var SpanConverter = class {
|
|
|
500
498
|
const agentAttrs = aiSpan.attributes;
|
|
501
499
|
if (agentAttrs.agentId) {
|
|
502
500
|
attributes["agent.id"] = agentAttrs.agentId;
|
|
501
|
+
attributes["gen_ai.agent.id"] = agentAttrs.agentId;
|
|
503
502
|
}
|
|
504
503
|
if (agentAttrs.maxSteps) {
|
|
505
504
|
attributes["agent.max_steps"] = agentAttrs.maxSteps;
|
|
@@ -557,7 +556,7 @@ var SpanConverter = class {
|
|
|
557
556
|
*/
|
|
558
557
|
getOperationName(aiSpan) {
|
|
559
558
|
switch (aiSpan.type) {
|
|
560
|
-
case aiTracing.AISpanType.
|
|
559
|
+
case aiTracing.AISpanType.MODEL_GENERATION: {
|
|
561
560
|
const attrs = aiSpan.attributes;
|
|
562
561
|
return attrs?.resultType === "tool_selection" ? "tool_selection" : "chat";
|
|
563
562
|
}
|
|
@@ -595,20 +594,18 @@ var SpanConverter = class {
|
|
|
595
594
|
};
|
|
596
595
|
|
|
597
596
|
// src/ai-tracing.ts
|
|
598
|
-
var OtelExporter = class {
|
|
597
|
+
var OtelExporter = class extends aiTracing.BaseExporter {
|
|
599
598
|
config;
|
|
600
599
|
tracingConfig;
|
|
601
600
|
spanConverter;
|
|
602
601
|
processor;
|
|
603
602
|
exporter;
|
|
604
603
|
isSetup = false;
|
|
605
|
-
isDisabled = false;
|
|
606
|
-
logger;
|
|
607
604
|
name = "opentelemetry";
|
|
608
605
|
constructor(config) {
|
|
606
|
+
super(config);
|
|
609
607
|
this.config = config;
|
|
610
608
|
this.spanConverter = new SpanConverter();
|
|
611
|
-
this.logger = new logger.ConsoleLogger({ level: config.logLevel ?? "warn" });
|
|
612
609
|
if (config.logLevel === "debug") {
|
|
613
610
|
api.diag.setLogger(new api.DiagConsoleLogger(), api.DiagLogLevel.DEBUG);
|
|
614
611
|
}
|
|
@@ -620,7 +617,7 @@ var OtelExporter = class {
|
|
|
620
617
|
this.tracingConfig = config;
|
|
621
618
|
}
|
|
622
619
|
async setupExporter() {
|
|
623
|
-
if (this.isSetup) return;
|
|
620
|
+
if (this.isSetup || this.exporter) return;
|
|
624
621
|
if (!this.config.provider) {
|
|
625
622
|
this.logger.error(
|
|
626
623
|
'[OtelExporter] Provider configuration is required. Use the "custom" provider for generic endpoints.'
|
|
@@ -635,6 +632,10 @@ var OtelExporter = class {
|
|
|
635
632
|
this.isSetup = true;
|
|
636
633
|
return;
|
|
637
634
|
}
|
|
635
|
+
if (this.config.exporter) {
|
|
636
|
+
this.exporter = this.config.exporter;
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
638
639
|
const endpoint = resolved.endpoint;
|
|
639
640
|
const headers = resolved.headers;
|
|
640
641
|
const protocol = resolved.protocol;
|
|
@@ -688,7 +689,10 @@ var OtelExporter = class {
|
|
|
688
689
|
this.isSetup = true;
|
|
689
690
|
return;
|
|
690
691
|
}
|
|
691
|
-
|
|
692
|
+
}
|
|
693
|
+
async setupProcessor() {
|
|
694
|
+
if (this.processor || this.isSetup) return;
|
|
695
|
+
let resource = resources.resourceFromAttributes({
|
|
692
696
|
[semanticConventions.ATTR_SERVICE_NAME]: this.tracingConfig?.serviceName || "mastra-service",
|
|
693
697
|
[semanticConventions.ATTR_SERVICE_VERSION]: "1.0.0",
|
|
694
698
|
// Add telemetry SDK information
|
|
@@ -696,6 +700,12 @@ var OtelExporter = class {
|
|
|
696
700
|
[semanticConventions.ATTR_TELEMETRY_SDK_VERSION]: "1.0.0",
|
|
697
701
|
[semanticConventions.ATTR_TELEMETRY_SDK_LANGUAGE]: "nodejs"
|
|
698
702
|
});
|
|
703
|
+
if (this.config.resourceAttributes) {
|
|
704
|
+
resource = resource.merge(
|
|
705
|
+
// Duplicate attributes from config will override defaults above
|
|
706
|
+
resources.resourceFromAttributes(this.config.resourceAttributes)
|
|
707
|
+
);
|
|
708
|
+
}
|
|
699
709
|
this.spanConverter = new SpanConverter(resource);
|
|
700
710
|
this.processor = new sdkTraceBase.BatchSpanProcessor(this.exporter, {
|
|
701
711
|
maxExportBatchSize: this.config.batchSize || 512,
|
|
@@ -710,12 +720,14 @@ var OtelExporter = class {
|
|
|
710
720
|
this.logger.debug(
|
|
711
721
|
`[OtelExporter] Using BatchSpanProcessor (batch size: ${this.config.batchSize || 512}, delay: 5s)`
|
|
712
722
|
);
|
|
723
|
+
}
|
|
724
|
+
async setup() {
|
|
725
|
+
if (this.isSetup) return;
|
|
726
|
+
await this.setupExporter();
|
|
727
|
+
await this.setupProcessor();
|
|
713
728
|
this.isSetup = true;
|
|
714
729
|
}
|
|
715
|
-
async
|
|
716
|
-
if (this.isDisabled) {
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
730
|
+
async _exportEvent(event) {
|
|
719
731
|
if (event.type !== aiTracing.AITracingEventType.SPAN_ENDED) {
|
|
720
732
|
return;
|
|
721
733
|
}
|
|
@@ -724,7 +736,7 @@ var OtelExporter = class {
|
|
|
724
736
|
}
|
|
725
737
|
async exportSpan(span) {
|
|
726
738
|
if (!this.isSetup) {
|
|
727
|
-
await this.
|
|
739
|
+
await this.setup();
|
|
728
740
|
}
|
|
729
741
|
if (this.isDisabled || !this.processor) {
|
|
730
742
|
return;
|