@mastra/observability 1.19.0-alpha.3 → 1.19.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/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/model-tracing.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2265,6 +2265,7 @@ var ModelSpanTracker = class {
|
|
|
2265
2265
|
#stepIndex = 0;
|
|
2266
2266
|
#chunkSequence = 0;
|
|
2267
2267
|
#completionStartTime;
|
|
2268
|
+
#inferenceCompletionStartTime;
|
|
2268
2269
|
#currentStepInputIsFinal = false;
|
|
2269
2270
|
/** When true, step-finish chunks don't auto-close the step span (for durable execution) */
|
|
2270
2271
|
#deferStepClose = false;
|
|
@@ -2286,8 +2287,9 @@ var ModelSpanTracker = class {
|
|
|
2286
2287
|
* Capture the completion start time (time to first token) when the first content chunk arrives.
|
|
2287
2288
|
*/
|
|
2288
2289
|
#captureCompletionStartTime() {
|
|
2289
|
-
|
|
2290
|
-
this.#completionStartTime
|
|
2290
|
+
const now = /* @__PURE__ */ new Date();
|
|
2291
|
+
this.#completionStartTime ??= now;
|
|
2292
|
+
this.#inferenceCompletionStartTime ??= now;
|
|
2291
2293
|
}
|
|
2292
2294
|
/**
|
|
2293
2295
|
* Get the tracing context for creating child spans.
|
|
@@ -2425,7 +2427,7 @@ var ModelSpanTracker = class {
|
|
|
2425
2427
|
usage,
|
|
2426
2428
|
finishReason: payload.stepResult.reason,
|
|
2427
2429
|
warnings: payload.stepResult.warnings,
|
|
2428
|
-
completionStartTime: this.#
|
|
2430
|
+
completionStartTime: this.#inferenceCompletionStartTime,
|
|
2429
2431
|
...responseModel?.trim() ? { responseModel } : {}
|
|
2430
2432
|
}
|
|
2431
2433
|
});
|
|
@@ -2449,6 +2451,7 @@ var ModelSpanTracker = class {
|
|
|
2449
2451
|
startInference(payload) {
|
|
2450
2452
|
if (!supportsModelInference()) return;
|
|
2451
2453
|
if (!this.#currentStepSpan || this.#currentInferenceSpan) return;
|
|
2454
|
+
this.#inferenceCompletionStartTime = void 0;
|
|
2452
2455
|
const input = extractStepInput(payload);
|
|
2453
2456
|
const generationAttrs = this.#modelSpan?.attributes;
|
|
2454
2457
|
const ctx = this.#inferenceContext;
|