@mastra/observability 1.5.0-alpha.0 → 1.5.1-alpha.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/CHANGELOG.md +23 -0
- package/dist/index.cjs +80 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +80 -43
- package/dist/index.js.map +1 -1
- package/dist/spans/serialization.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @mastra/observability
|
|
2
2
|
|
|
3
|
+
## 1.5.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed span serialization to avoid incorrect [Circular] placeholders in traces. ([#14263](https://github.com/mastra-ai/mastra/pull/14263))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`cb611a1`](https://github.com/mastra-ai/mastra/commit/cb611a1e89a4f4cf74c97b57e0c27bb56f2eceb5), [`62d1d3c`](https://github.com/mastra-ai/mastra/commit/62d1d3cc08fe8182e7080237fd975de862ec8c91), [`8681ecb`](https://github.com/mastra-ai/mastra/commit/8681ecb86184d5907267000e4576cc442a9a83fc), [`28d0249`](https://github.com/mastra-ai/mastra/commit/28d0249295782277040ad1e0d243e695b7ab1ce4), [`bb0f09d`](https://github.com/mastra-ai/mastra/commit/bb0f09dbac58401b36069f483acf5673202db5b5), [`5f7e9d0`](https://github.com/mastra-ai/mastra/commit/5f7e9d0db664020e1f3d97d7d18c6b0b9d4843d0)]:
|
|
10
|
+
- @mastra/core@1.15.0-alpha.0
|
|
11
|
+
|
|
12
|
+
## 1.5.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Updated exporters and event bus to use renamed observability types from `@mastra/core`. Added `EventBuffer` for batching non-tracing signals with configurable flush intervals. ([#14214](https://github.com/mastra-ai/mastra/pull/14214))
|
|
17
|
+
|
|
18
|
+
**Breaking changes:**
|
|
19
|
+
- `ObservabilityBus` now takes a config object in its constructor (`cardinalityFilter`, `autoExtractMetrics`); `setCardinalityFilter()` and `enableAutoExtractedMetrics()` removed
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`ea86967`](https://github.com/mastra-ai/mastra/commit/ea86967449426e0a3673253bd1c2c052a99d970d), [`db21c21`](https://github.com/mastra-ai/mastra/commit/db21c21a6ae5f33539262cc535342fa8757eb359), [`11f5dbe`](https://github.com/mastra-ai/mastra/commit/11f5dbe9a1e7ad8ef3b1ea34fb4a9fa3631d1587), [`6751354`](https://github.com/mastra-ai/mastra/commit/67513544d1a64be891d9de7624d40aadc895d56e), [`c958cd3`](https://github.com/mastra-ai/mastra/commit/c958cd36627c1eea122ec241b2b15492977a263a), [`86f2426`](https://github.com/mastra-ai/mastra/commit/86f242631d252a172d2f9f9a2ea0feb8647a76b0), [`950eb07`](https://github.com/mastra-ai/mastra/commit/950eb07b7e7354629630e218d49550fdd299c452)]:
|
|
24
|
+
- @mastra/core@1.13.0
|
|
25
|
+
|
|
3
26
|
## 1.5.0-alpha.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -17950,6 +17950,17 @@ function compressJsonSchema(schema, depth = 0) {
|
|
|
17950
17950
|
if (depth > 3) {
|
|
17951
17951
|
return schema.type || "object";
|
|
17952
17952
|
}
|
|
17953
|
+
const compositionKeys = ["oneOf", "anyOf", "allOf"].filter((key) => Array.isArray(schema[key]));
|
|
17954
|
+
if (compositionKeys.length > 0) {
|
|
17955
|
+
const compressed2 = {};
|
|
17956
|
+
for (const key of compositionKeys) {
|
|
17957
|
+
compressed2[key] = schema[key].map((entry) => compressJsonSchema(entry, depth + 1));
|
|
17958
|
+
}
|
|
17959
|
+
if (typeof schema.type === "string") {
|
|
17960
|
+
compressed2.type = schema.type;
|
|
17961
|
+
}
|
|
17962
|
+
return compressed2;
|
|
17963
|
+
}
|
|
17953
17964
|
if (schema.type !== "object" || !schema.properties) {
|
|
17954
17965
|
return schema.type || schema;
|
|
17955
17966
|
}
|
|
@@ -17983,7 +17994,7 @@ function compressJsonSchema(schema, depth = 0) {
|
|
|
17983
17994
|
function deepClean(value, options = DEFAULT_DEEP_CLEAN_OPTIONS) {
|
|
17984
17995
|
const { keysToStrip, maxDepth, maxStringLength, maxArrayLength, maxObjectKeys } = options;
|
|
17985
17996
|
const stripSet = keysToStrip instanceof Set ? keysToStrip : new Set(Array.isArray(keysToStrip) ? keysToStrip : Object.keys(keysToStrip));
|
|
17986
|
-
const
|
|
17997
|
+
const ancestors = /* @__PURE__ */ new WeakSet();
|
|
17987
17998
|
function helper(val, depth) {
|
|
17988
17999
|
if (depth > maxDepth) {
|
|
17989
18000
|
return "[MaxDepth]";
|
|
@@ -18016,59 +18027,85 @@ function deepClean(value, options = DEFAULT_DEEP_CLEAN_OPTIONS) {
|
|
|
18016
18027
|
};
|
|
18017
18028
|
}
|
|
18018
18029
|
if (typeof val === "object") {
|
|
18019
|
-
if (
|
|
18030
|
+
if (ancestors.has(val)) {
|
|
18020
18031
|
return "[Circular]";
|
|
18021
18032
|
}
|
|
18022
|
-
|
|
18033
|
+
ancestors.add(val);
|
|
18023
18034
|
}
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18035
|
+
try {
|
|
18036
|
+
if (Array.isArray(val)) {
|
|
18037
|
+
const cleaned2 = [];
|
|
18038
|
+
for (let i = 0; i < Math.min(val.length, maxArrayLength); i++) {
|
|
18039
|
+
try {
|
|
18040
|
+
cleaned2.push(helper(val[i], depth + 1));
|
|
18041
|
+
} catch (error48) {
|
|
18042
|
+
cleaned2.push(`[${error48 instanceof Error ? truncateString(error48.message, 256) : "unknown error"}]`);
|
|
18043
|
+
}
|
|
18044
|
+
}
|
|
18045
|
+
if (val.length > maxArrayLength) {
|
|
18046
|
+
cleaned2.push(`[\u2026${val.length - maxArrayLength} more items]`);
|
|
18047
|
+
}
|
|
18048
|
+
return cleaned2;
|
|
18029
18049
|
}
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer(val)) {
|
|
18033
|
-
return `[Buffer length=${val.length}]`;
|
|
18034
|
-
}
|
|
18035
|
-
if (ArrayBuffer.isView(val)) {
|
|
18036
|
-
const ctor = val.constructor?.name ?? "TypedArray";
|
|
18037
|
-
const byteLength = val.byteLength ?? "?";
|
|
18038
|
-
return `[${ctor} byteLength=${byteLength}]`;
|
|
18039
|
-
}
|
|
18040
|
-
if (val instanceof ArrayBuffer) {
|
|
18041
|
-
return `[ArrayBuffer byteLength=${val.byteLength}]`;
|
|
18042
|
-
}
|
|
18043
|
-
if (typeof val.serializeForSpan === "function") {
|
|
18044
|
-
try {
|
|
18045
|
-
return helper(val.serializeForSpan(), depth);
|
|
18046
|
-
} catch {
|
|
18050
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(val)) {
|
|
18051
|
+
return `[Buffer length=${val.length}]`;
|
|
18047
18052
|
}
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
const cleaned = {};
|
|
18053
|
-
const entries = Object.entries(val);
|
|
18054
|
-
let keyCount = 0;
|
|
18055
|
-
for (const [key, v] of entries) {
|
|
18056
|
-
if (stripSet.has(key)) {
|
|
18057
|
-
continue;
|
|
18053
|
+
if (ArrayBuffer.isView(val)) {
|
|
18054
|
+
const ctor = val.constructor?.name ?? "TypedArray";
|
|
18055
|
+
const byteLength = val.byteLength ?? "?";
|
|
18056
|
+
return `[${ctor} byteLength=${byteLength}]`;
|
|
18058
18057
|
}
|
|
18059
|
-
if (
|
|
18060
|
-
|
|
18061
|
-
break;
|
|
18058
|
+
if (val instanceof ArrayBuffer) {
|
|
18059
|
+
return `[ArrayBuffer byteLength=${val.byteLength}]`;
|
|
18062
18060
|
}
|
|
18061
|
+
let serializeForSpan;
|
|
18063
18062
|
try {
|
|
18064
|
-
|
|
18065
|
-
keyCount++;
|
|
18063
|
+
serializeForSpan = val.serializeForSpan;
|
|
18066
18064
|
} catch (error48) {
|
|
18067
|
-
|
|
18068
|
-
|
|
18065
|
+
return `[serializeForSpan failed: ${error48 instanceof Error ? truncateString(error48.message, 256) : "unknown error"}]`;
|
|
18066
|
+
}
|
|
18067
|
+
if (typeof serializeForSpan === "function") {
|
|
18068
|
+
try {
|
|
18069
|
+
return helper(serializeForSpan.call(val), depth);
|
|
18070
|
+
} catch (error48) {
|
|
18071
|
+
return `[serializeForSpan failed: ${error48 instanceof Error ? truncateString(error48.message, 256) : "unknown error"}]`;
|
|
18072
|
+
}
|
|
18073
|
+
}
|
|
18074
|
+
let looksLikeJsonSchema = false;
|
|
18075
|
+
try {
|
|
18076
|
+
looksLikeJsonSchema = isJsonSchema(val);
|
|
18077
|
+
} catch {
|
|
18078
|
+
looksLikeJsonSchema = false;
|
|
18079
|
+
}
|
|
18080
|
+
if (looksLikeJsonSchema) {
|
|
18081
|
+
try {
|
|
18082
|
+
const compressed = compressJsonSchema(val);
|
|
18083
|
+
return compressed === val ? "[JSONSchema]" : helper(compressed, depth);
|
|
18084
|
+
} catch {
|
|
18085
|
+
}
|
|
18086
|
+
}
|
|
18087
|
+
const cleaned = {};
|
|
18088
|
+
const keys = Object.keys(val).filter((key) => !stripSet.has(key));
|
|
18089
|
+
let keyCount = 0;
|
|
18090
|
+
for (const key of keys) {
|
|
18091
|
+
if (keyCount >= maxObjectKeys) {
|
|
18092
|
+
cleaned["__truncated"] = `${keys.length - keyCount} more keys omitted`;
|
|
18093
|
+
break;
|
|
18094
|
+
}
|
|
18095
|
+
try {
|
|
18096
|
+
cleaned[key] = helper(val[key], depth + 1);
|
|
18097
|
+
keyCount++;
|
|
18098
|
+
} catch (error48) {
|
|
18099
|
+
cleaned[key] = `[${error48 instanceof Error ? truncateString(error48.message, 256) : "unknown error"}]`;
|
|
18100
|
+
keyCount++;
|
|
18101
|
+
}
|
|
18102
|
+
}
|
|
18103
|
+
return cleaned;
|
|
18104
|
+
} finally {
|
|
18105
|
+
if (typeof val === "object" && val !== null) {
|
|
18106
|
+
ancestors.delete(val);
|
|
18069
18107
|
}
|
|
18070
18108
|
}
|
|
18071
|
-
return cleaned;
|
|
18072
18109
|
}
|
|
18073
18110
|
return helper(value, 0);
|
|
18074
18111
|
}
|