@mastra/observability 1.24.0-alpha.3 → 1.24.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.
@@ -3,7 +3,7 @@ name: mastra-observability
3
3
  description: Documentation for @mastra/observability. Use when working with @mastra/observability APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/observability"
6
- version: "1.24.0-alpha.3"
6
+ version: "1.24.0-alpha.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "1.24.0-alpha.3",
2
+ "version": "1.24.0-alpha.4",
3
3
  "package": "@mastra/observability",
4
4
  "exports": {
5
5
  "BaseExporter": {
6
6
  "types": "dist/exporters/base.d.ts",
7
7
  "implementation": "dist/index.js",
8
- "line": 4238
8
+ "line": 4249
9
9
  },
10
10
  "BaseObservabilityEventBus": {
11
11
  "types": "dist/bus/base.d.ts",
@@ -15,12 +15,12 @@
15
15
  "BaseObservabilityInstance": {
16
16
  "types": "dist/instances/base.d.ts",
17
17
  "implementation": "dist/index.js",
18
- "line": 5714
18
+ "line": 5725
19
19
  },
20
20
  "BaseSpan": {
21
21
  "types": "dist/spans/base.d.ts",
22
22
  "implementation": "dist/index.js",
23
- "line": 3523
23
+ "line": 3534
24
24
  },
25
25
  "CardinalityFilter": {
26
26
  "types": "dist/metrics/cardinality.d.ts",
@@ -30,12 +30,12 @@
30
30
  "CloudExporter": {
31
31
  "types": "dist/exporters/cloud.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 8133
33
+ "line": 8144
34
34
  },
35
35
  "ConsoleExporter": {
36
36
  "types": "dist/exporters/console.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 8456
38
+ "line": 8467
39
39
  },
40
40
  "DEFAULT_DEEP_CLEAN_OPTIONS": {
41
41
  "types": "dist/spans/serialization.d.ts",
@@ -45,27 +45,27 @@
45
45
  "DEFAULT_LIMITS": {
46
46
  "types": "dist/client/proxy.d.ts",
47
47
  "implementation": "dist/index.js",
48
- "line": 6699
48
+ "line": 6710
49
49
  },
50
50
  "DefaultExporter": {
51
51
  "types": "dist/exporters/default.d.ts",
52
52
  "implementation": "dist/index.js",
53
- "line": 4620
53
+ "line": 4631
54
54
  },
55
55
  "DefaultObservabilityInstance": {
56
56
  "types": "dist/instances/default.d.ts",
57
57
  "implementation": "dist/index.js",
58
- "line": 10283
58
+ "line": 10294
59
59
  },
60
60
  "DefaultSpan": {
61
61
  "types": "dist/spans/default.d.ts",
62
62
  "implementation": "dist/index.js",
63
- "line": 4009
63
+ "line": 4020
64
64
  },
65
65
  "JsonExporter": {
66
66
  "types": "dist/exporters/test.d.ts",
67
67
  "implementation": "dist/index.js",
68
- "line": 10281
68
+ "line": 10292
69
69
  },
70
70
  "LoggerContextImpl": {
71
71
  "types": "dist/context/logger.d.ts",
@@ -75,12 +75,12 @@
75
75
  "MastraPlatformExporter": {
76
76
  "types": "dist/exporters/mastra-platform.d.ts",
77
77
  "implementation": "dist/index.js",
78
- "line": 8751
78
+ "line": 8762
79
79
  },
80
80
  "MastraStorageExporter": {
81
81
  "types": "dist/exporters/mastra-storage.d.ts",
82
82
  "implementation": "dist/index.js",
83
- "line": 5139
83
+ "line": 5150
84
84
  },
85
85
  "MetricsContextImpl": {
86
86
  "types": "dist/context/metrics.d.ts",
@@ -95,17 +95,17 @@
95
95
  "NoOpSpan": {
96
96
  "types": "dist/spans/no-op.d.ts",
97
97
  "implementation": "dist/index.js",
98
- "line": 4181
98
+ "line": 4192
99
99
  },
100
100
  "OBSERVABILITY_CAPABILITIES_HEADER": {
101
101
  "types": "dist/exporters/mastra-platform.d.ts",
102
102
  "implementation": "dist/index.js",
103
- "line": 8652
103
+ "line": 8663
104
104
  },
105
105
  "Observability": {
106
106
  "types": "dist/default.d.ts",
107
107
  "implementation": "dist/index.js",
108
- "line": 10940
108
+ "line": 10951
109
109
  },
110
110
  "ObservabilityBus": {
111
111
  "types": "dist/bus/observability-bus.d.ts",
@@ -115,7 +115,7 @@
115
115
  "QUOTA_PAUSE_CAPABILITY": {
116
116
  "types": "dist/exporters/mastra-platform.d.ts",
117
117
  "implementation": "dist/index.js",
118
- "line": 8653
118
+ "line": 8664
119
119
  },
120
120
  "SamplingStrategyType": {
121
121
  "types": "dist/config.d.ts",
@@ -125,57 +125,57 @@
125
125
  "SensitiveDataFilter": {
126
126
  "types": "dist/span_processors/sensitive-data-filter.d.ts",
127
127
  "implementation": "dist/index.js",
128
- "line": 10710
128
+ "line": 10721
129
129
  },
130
130
  "TestExporter": {
131
131
  "types": "dist/exporters/test.d.ts",
132
132
  "implementation": "dist/index.js",
133
- "line": 9296
133
+ "line": 9307
134
134
  },
135
135
  "TraceData": {
136
136
  "types": "dist/exporters/tracking.d.ts",
137
137
  "implementation": "dist/index.js",
138
- "line": 6852
138
+ "line": 6863
139
139
  },
140
140
  "TrackingExporter": {
141
141
  "types": "dist/exporters/tracking.d.ts",
142
142
  "implementation": "dist/index.js",
143
- "line": 7181
143
+ "line": 7192
144
144
  },
145
145
  "buildExportedLog": {
146
146
  "types": "dist/client/otlp.d.ts",
147
147
  "implementation": "dist/index.js",
148
- "line": 6616
148
+ "line": 6627
149
149
  },
150
150
  "buildExportedSpan": {
151
151
  "types": "dist/client/otlp.d.ts",
152
152
  "implementation": "dist/index.js",
153
- "line": 6598
153
+ "line": 6609
154
154
  },
155
155
  "buildTracingOptions": {
156
156
  "types": "dist/tracing-options.d.ts",
157
157
  "implementation": "dist/index.js",
158
- "line": 11285
158
+ "line": 11296
159
159
  },
160
160
  "chainFormatters": {
161
161
  "types": "dist/exporters/span-formatters.d.ts",
162
162
  "implementation": "dist/index.js",
163
- "line": 7947
163
+ "line": 7958
164
164
  },
165
165
  "createClientObservabilityProxy": {
166
166
  "types": "dist/client/proxy.d.ts",
167
167
  "implementation": "dist/index.js",
168
- "line": 6833
168
+ "line": 6844
169
169
  },
170
170
  "decodeResourceLogs": {
171
171
  "types": "dist/client/otlp.d.ts",
172
172
  "implementation": "dist/index.js",
173
- "line": 6535
173
+ "line": 6546
174
174
  },
175
175
  "decodeResourceSpans": {
176
176
  "types": "dist/client/otlp.d.ts",
177
177
  "implementation": "dist/index.js",
178
- "line": 6498
178
+ "line": 6509
179
179
  },
180
180
  "deepClean": {
181
181
  "types": "dist/spans/serialization.d.ts",
@@ -185,17 +185,17 @@
185
185
  "formatBaggage": {
186
186
  "types": "dist/client/w3c.d.ts",
187
187
  "implementation": "dist/index.js",
188
- "line": 6689
188
+ "line": 6700
189
189
  },
190
190
  "formatTraceparent": {
191
191
  "types": "dist/client/w3c.d.ts",
192
192
  "implementation": "dist/index.js",
193
- "line": 6652
193
+ "line": 6663
194
194
  },
195
195
  "getExternalParentId": {
196
196
  "types": "dist/spans/base.d.ts",
197
197
  "implementation": "dist/index.js",
198
- "line": 3504
198
+ "line": 3515
199
199
  },
200
200
  "isSerializedMap": {
201
201
  "types": "dist/spans/serialization.d.ts",
@@ -215,7 +215,7 @@
215
215
  "observabilityFeatures": {
216
216
  "types": "dist/features.d.ts",
217
217
  "implementation": "dist/index.js",
218
- "line": 11266
218
+ "line": 11277
219
219
  },
220
220
  "observabilityInstanceConfigSchema": {
221
221
  "types": "dist/config.d.ts",
@@ -230,17 +230,17 @@
230
230
  "otlpSeverityToLogLevel": {
231
231
  "types": "dist/client/otlp.d.ts",
232
232
  "implementation": "dist/index.js",
233
- "line": 6572
233
+ "line": 6583
234
234
  },
235
235
  "parseBaggage": {
236
236
  "types": "dist/client/w3c.d.ts",
237
237
  "implementation": "dist/index.js",
238
- "line": 6662
238
+ "line": 6673
239
239
  },
240
240
  "parseTraceparent": {
241
241
  "types": "dist/client/w3c.d.ts",
242
242
  "implementation": "dist/index.js",
243
- "line": 6638
243
+ "line": 6649
244
244
  },
245
245
  "reconstructSerializedMap": {
246
246
  "types": "dist/spans/serialization.d.ts",
package/dist/index.cjs CHANGED
@@ -3252,11 +3252,22 @@ var ModelSpanTracker = class {
3252
3252
  * create MODEL_STEP and MODEL_CHUNK spans for each semantic unit in the stream.
3253
3253
  */
3254
3254
  wrapStream(stream, inferenceOnly = false) {
3255
+ let servedModelId;
3255
3256
  return stream.pipeThrough(new stream_web.TransformStream({ transform: (chunk, controller) => {
3256
3257
  if (inferenceOnly) {
3257
3258
  try {
3259
+ if (chunk.type === "response-metadata" && typeof chunk.payload?.modelId === "string") servedModelId = chunk.payload.modelId;
3258
3260
  if (MODEL_RESPONSE_CHUNK_TYPES.has(chunk.type)) this.#captureCompletionStartTime();
3259
- if (chunk.type === "finish") this.#endInferenceSpan(chunk.payload, false);
3261
+ if (chunk.type === "finish") {
3262
+ const payload = servedModelId && !chunk.payload?.metadata?.modelId ? {
3263
+ ...chunk.payload,
3264
+ metadata: {
3265
+ ...chunk.payload?.metadata,
3266
+ modelId: servedModelId
3267
+ }
3268
+ } : chunk.payload;
3269
+ this.#endInferenceSpan(payload, false);
3270
+ }
3260
3271
  } catch {}
3261
3272
  controller.enqueue(chunk);
3262
3273
  return;