@mastra/observability 1.24.0-alpha.6 → 1.24.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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +33 -33
- package/dist/index.cjs +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/instances/base.d.ts.map +1 -1
- package/dist/spans/base.d.ts +7 -0
- package/dist/spans/base.d.ts.map +1 -1
- package/dist/spans/default.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -3596,6 +3596,23 @@ var BaseSpan = class BaseSpan {
|
|
|
3596
3596
|
tags;
|
|
3597
3597
|
links;
|
|
3598
3598
|
traceState;
|
|
3599
|
+
localErrorCount = typeof coreObservability.claimSpanError === "function" ? 0 : void 0;
|
|
3600
|
+
errorOccurrenceIds;
|
|
3601
|
+
recordError(error, options) {
|
|
3602
|
+
if (this.isEvent || this.endTime) return;
|
|
3603
|
+
if (error === null || typeof error !== "object" && typeof error !== "function") {
|
|
3604
|
+
this.localErrorCount = void 0;
|
|
3605
|
+
return;
|
|
3606
|
+
}
|
|
3607
|
+
const id = coreObservability.claimSpanError?.(error, this.traceId, this.id, options);
|
|
3608
|
+
if (this.isExcluded || id === void 0 || this.errorOccurrenceIds?.has(id)) return;
|
|
3609
|
+
(this.errorOccurrenceIds ??= /* @__PURE__ */ new Set()).add(id);
|
|
3610
|
+
if (this.localErrorCount !== void 0) this.localErrorCount++;
|
|
3611
|
+
}
|
|
3612
|
+
restoreErrorCount(cached) {
|
|
3613
|
+
this.localErrorCount = typeof coreObservability.claimSpanError !== "function" || cached.errorCount && !cached.errorOccurrenceIds ? void 0 : cached.errorCount;
|
|
3614
|
+
this.errorOccurrenceIds = cached.errorOccurrenceIds?.length ? new Set(cached.errorOccurrenceIds) : void 0;
|
|
3615
|
+
}
|
|
3599
3616
|
/** Entity type that created the span (e.g., agent, workflow) */
|
|
3600
3617
|
entityType;
|
|
3601
3618
|
/** Entity ID that created the span */
|
|
@@ -3979,6 +3996,7 @@ var BaseSpan = class BaseSpan {
|
|
|
3979
3996
|
input: hideInput ? void 0 : this.input,
|
|
3980
3997
|
output: hideOutput ? void 0 : this.output,
|
|
3981
3998
|
errorInfo: hideInput || hideOutput ? redactErrorInfo(this.errorInfo, this.errorStackMessage) : this.errorInfo,
|
|
3999
|
+
...this.localErrorCount !== void 0 ? { errorCount: this.localErrorCount } : {},
|
|
3982
4000
|
...this.outcome !== void 0 ? { outcome: this.outcome } : {},
|
|
3983
4001
|
...this.stopReason !== void 0 ? { stopReason: this.stopReason } : {},
|
|
3984
4002
|
...this.stopReasonContext !== void 0 ? { stopReasonContext: this.stopReasonContext } : {},
|
|
@@ -4004,6 +4022,7 @@ var BaseSpan = class BaseSpan {
|
|
|
4004
4022
|
return {
|
|
4005
4023
|
...this.exportSpan(this.observabilityInstance.getConfig().includeInternalSpans),
|
|
4006
4024
|
ownEntityVersionId: this.ownEntityVersionId ?? null,
|
|
4025
|
+
...this.errorOccurrenceIds ? { errorOccurrenceIds: [...this.errorOccurrenceIds] } : {},
|
|
4007
4026
|
...this.traceState ? { traceState: this.traceState } : {}
|
|
4008
4027
|
};
|
|
4009
4028
|
}
|
|
@@ -4123,6 +4142,7 @@ var DefaultSpan = class extends BaseSpan {
|
|
|
4123
4142
|
error(options) {
|
|
4124
4143
|
if (this.isEvent || this.endTime) return;
|
|
4125
4144
|
const { error, endSpan = true, endTree, attributes, metadata } = options;
|
|
4145
|
+
this.recordError(error, { origin: options.origin });
|
|
4126
4146
|
this.applyOutcome(options);
|
|
4127
4147
|
if (metadata) this.metadata = {
|
|
4128
4148
|
...this.metadata,
|
|
@@ -6411,7 +6431,10 @@ var BaseObservabilityInstance = class extends MastraBase {
|
|
|
6411
6431
|
tracingPolicy: cached.isInternal ? { internal: InternalSpans.ALL } : void 0,
|
|
6412
6432
|
traceState: this.rebuildTraceState(cached)
|
|
6413
6433
|
});
|
|
6414
|
-
if (span instanceof BaseSpan)
|
|
6434
|
+
if (span instanceof BaseSpan) {
|
|
6435
|
+
span.restoreEntityLineage(cached);
|
|
6436
|
+
span.restoreErrorCount(cached);
|
|
6437
|
+
}
|
|
6415
6438
|
if (cached.endTime) {
|
|
6416
6439
|
span.endTime = cached.endTime instanceof Date ? cached.endTime : new Date(cached.endTime);
|
|
6417
6440
|
span.output = cached.output;
|