@mastra/observability 1.19.0-alpha.3 → 1.19.0
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 +6 -6
package/dist/index.js
CHANGED
|
@@ -2240,6 +2240,7 @@ var ModelSpanTracker = class {
|
|
|
2240
2240
|
#stepIndex = 0;
|
|
2241
2241
|
#chunkSequence = 0;
|
|
2242
2242
|
#completionStartTime;
|
|
2243
|
+
#inferenceCompletionStartTime;
|
|
2243
2244
|
#currentStepInputIsFinal = false;
|
|
2244
2245
|
/** When true, step-finish chunks don't auto-close the step span (for durable execution) */
|
|
2245
2246
|
#deferStepClose = false;
|
|
@@ -2261,8 +2262,9 @@ var ModelSpanTracker = class {
|
|
|
2261
2262
|
* Capture the completion start time (time to first token) when the first content chunk arrives.
|
|
2262
2263
|
*/
|
|
2263
2264
|
#captureCompletionStartTime() {
|
|
2264
|
-
|
|
2265
|
-
this.#completionStartTime
|
|
2265
|
+
const now = /* @__PURE__ */ new Date();
|
|
2266
|
+
this.#completionStartTime ??= now;
|
|
2267
|
+
this.#inferenceCompletionStartTime ??= now;
|
|
2266
2268
|
}
|
|
2267
2269
|
/**
|
|
2268
2270
|
* Get the tracing context for creating child spans.
|
|
@@ -2400,7 +2402,7 @@ var ModelSpanTracker = class {
|
|
|
2400
2402
|
usage,
|
|
2401
2403
|
finishReason: payload.stepResult.reason,
|
|
2402
2404
|
warnings: payload.stepResult.warnings,
|
|
2403
|
-
completionStartTime: this.#
|
|
2405
|
+
completionStartTime: this.#inferenceCompletionStartTime,
|
|
2404
2406
|
...responseModel?.trim() ? { responseModel } : {}
|
|
2405
2407
|
}
|
|
2406
2408
|
});
|
|
@@ -2424,6 +2426,7 @@ var ModelSpanTracker = class {
|
|
|
2424
2426
|
startInference(payload) {
|
|
2425
2427
|
if (!supportsModelInference()) return;
|
|
2426
2428
|
if (!this.#currentStepSpan || this.#currentInferenceSpan) return;
|
|
2429
|
+
this.#inferenceCompletionStartTime = void 0;
|
|
2427
2430
|
const input = extractStepInput(payload);
|
|
2428
2431
|
const generationAttrs = this.#modelSpan?.attributes;
|
|
2429
2432
|
const ctx = this.#inferenceContext;
|