@mastra/observability 1.17.2 → 1.17.3
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 +26 -0
- package/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/instances/base.d.ts.map +1 -1
- package/dist/spans/base.d.ts +14 -0
- package/dist/spans/base.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/observability
|
|
2
2
|
|
|
3
|
+
## 1.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed the "Span not found." error when opening the span linked from a log or metric in Studio. ([#22286](https://github.com/mastra-ai/mastra/pull/22286))
|
|
8
|
+
|
|
9
|
+
Logs and metrics emitted inside an internal or excluded span were stamped with that span's own id. Those spans are dropped before export, so the id referenced a span no exporter ever received, and clicking through from a log detail panel returned a 404.
|
|
10
|
+
|
|
11
|
+
Logs and metrics now resolve to the nearest ancestor span that actually reaches exporters, and omit `spanId` entirely when no such ancestor exists. This applies to newly emitted signals; already-stored logs and metrics keep the ids they were written with.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`7176362`](https://github.com/mastra-ai/mastra/commit/717636281a3339911a05ea2cc8ae38afe4fd2cef), [`9045b8f`](https://github.com/mastra-ai/mastra/commit/9045b8fdf622e1d735b96ddd6500bd32556636d9), [`7677a2c`](https://github.com/mastra-ai/mastra/commit/7677a2cd47729221ca28afc5067d26e22d925b59), [`e3b796d`](https://github.com/mastra-ai/mastra/commit/e3b796d29a63f0d5c97dd815aadec40687346d70), [`f7a7467`](https://github.com/mastra-ai/mastra/commit/f7a74678193921e7ea4790232d707b3237626cac), [`49ccd14`](https://github.com/mastra-ai/mastra/commit/49ccd142268a61fb55ea75bc76287643a21f3677), [`f9c56f3`](https://github.com/mastra-ai/mastra/commit/f9c56f336ee8c250763a438990f8e60a428353c9), [`3855b38`](https://github.com/mastra-ai/mastra/commit/3855b38c4c25af32ab8e298e148becc963abe92c)]:
|
|
14
|
+
- @mastra/core@1.63.0
|
|
15
|
+
|
|
16
|
+
## 1.17.3-alpha.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fixed the "Span not found." error when opening the span linked from a log or metric in Studio. ([#22286](https://github.com/mastra-ai/mastra/pull/22286))
|
|
21
|
+
|
|
22
|
+
Logs and metrics emitted inside an internal or excluded span were stamped with that span's own id. Those spans are dropped before export, so the id referenced a span no exporter ever received, and clicking through from a log detail panel returned a 404.
|
|
23
|
+
|
|
24
|
+
Logs and metrics now resolve to the nearest ancestor span that actually reaches exporters, and omit `spanId` entirely when no such ancestor exists. This applies to newly emitted signals; already-stored logs and metrics keep the ids they were written with.
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`7176362`](https://github.com/mastra-ai/mastra/commit/717636281a3339911a05ea2cc8ae38afe4fd2cef), [`e3b796d`](https://github.com/mastra-ai/mastra/commit/e3b796d29a63f0d5c97dd815aadec40687346d70), [`49ccd14`](https://github.com/mastra-ai/mastra/commit/49ccd142268a61fb55ea75bc76287643a21f3677), [`3855b38`](https://github.com/mastra-ai/mastra/commit/3855b38c4c25af32ab8e298e148becc963abe92c)]:
|
|
27
|
+
- @mastra/core@1.63.0-alpha.0
|
|
28
|
+
|
|
3
29
|
## 1.17.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -2879,6 +2879,23 @@ var BaseSpan = class BaseSpan {
|
|
|
2879
2879
|
if (parent.isExcluded || !includeInternalSpans && parent.isInternal) return parent.getParentSpan(includeInternalSpans);
|
|
2880
2880
|
return this.parent;
|
|
2881
2881
|
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Get the spanId that observability signals (logs, metrics, scores) should
|
|
2884
|
+
* reference for this span. If this span itself reaches exporters, that is
|
|
2885
|
+
* its own id. If it is excluded from export (internal span, excludeSpanTypes,
|
|
2886
|
+
* or NoOpSpan), resolves to the nearest exportable ancestor instead.
|
|
2887
|
+
* Returns undefined when no exportable ancestor exists.
|
|
2888
|
+
*
|
|
2889
|
+
* Only covers exclusions known when the span is created (`isExcluded`). A
|
|
2890
|
+
* `spanFilter` or a span output processor can still drop a span at export
|
|
2891
|
+
* time — both run on the exported span data after the span ends, so their
|
|
2892
|
+
* verdict isn't knowable while signals are being stamped. Signals emitted
|
|
2893
|
+
* inside a span dropped that way still reference its own id.
|
|
2894
|
+
*/
|
|
2895
|
+
getExportedSpanId() {
|
|
2896
|
+
if (!this.isExcluded) return this.id;
|
|
2897
|
+
return this.getParentSpanId(this.observabilityInstance.getConfig().includeInternalSpans);
|
|
2898
|
+
}
|
|
2882
2899
|
/** Get the closest parent spanId that will reach exporters (unless includeInternalSpans) */
|
|
2883
2900
|
getParentSpanId(includeInternalSpans) {
|
|
2884
2901
|
if (!this.parent) return this.parentSpanId;
|
|
@@ -2920,7 +2937,7 @@ var BaseSpan = class BaseSpan {
|
|
|
2920
2937
|
const rootTags = rootSpan.tags?.length ? [...rootSpan.tags] : void 0;
|
|
2921
2938
|
this.correlationContext = {
|
|
2922
2939
|
traceId: this.traceId,
|
|
2923
|
-
spanId: this.
|
|
2940
|
+
spanId: this.getExportedSpanId(),
|
|
2924
2941
|
tags: rootTags,
|
|
2925
2942
|
entityType: this.entityType,
|
|
2926
2943
|
entityId: this.entityId,
|
|
@@ -3439,7 +3456,7 @@ var BaseObservabilityInstance = class extends _mastra_core_base.MastraBase {
|
|
|
3439
3456
|
const metadata = span?.metadata ? structuredClone(span.metadata) : void 0;
|
|
3440
3457
|
return new LoggerContextImpl({
|
|
3441
3458
|
traceId: span?.traceId,
|
|
3442
|
-
spanId: span
|
|
3459
|
+
spanId: (0, _mastra_core_observability.resolveExportedSpanId)(span),
|
|
3443
3460
|
correlationContext,
|
|
3444
3461
|
metadata,
|
|
3445
3462
|
observabilityBus: this.observabilityBus,
|
|
@@ -3456,7 +3473,7 @@ var BaseObservabilityInstance = class extends _mastra_core_base.MastraBase {
|
|
|
3456
3473
|
const metadata = span?.metadata ? structuredClone(span.metadata) : void 0;
|
|
3457
3474
|
return new MetricsContextImpl({
|
|
3458
3475
|
traceId: span?.traceId,
|
|
3459
|
-
spanId: span
|
|
3476
|
+
spanId: (0, _mastra_core_observability.resolveExportedSpanId)(span),
|
|
3460
3477
|
correlationContext,
|
|
3461
3478
|
metadata,
|
|
3462
3479
|
cardinalityFilter: this.cardinalityFilter,
|