@mastra/observability 1.9.1-alpha.2 → 1.9.2-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 +40 -0
- package/dist/exporters/cloud.d.ts.map +1 -1
- package/dist/index.cjs +5 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -52
- package/dist/index.js.map +1 -1
- package/dist/model-tracing.d.ts.map +1 -1
- package/dist/spans/serialization.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @mastra/observability
|
|
2
2
|
|
|
3
|
+
## 1.9.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed span serialization replacing tool parameter JSON schemas with lossy summaries like `"unknown (required)"`. JSON schemas in span data are now preserved as-is, keeping full type information for debugging in observability tools like Datadog. Also fixed MODEL_STEP span input showing only a keys summary instead of actual messages for AI SDK v5 providers. ([#15404](https://github.com/mastra-ai/mastra/pull/15404))
|
|
8
|
+
|
|
9
|
+
- Fixed CloudExporter to default to observability.mastra.ai for Mastra platform exports. ([#15418](https://github.com/mastra-ai/mastra/pull/15418))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`3d83d06`](https://github.com/mastra-ai/mastra/commit/3d83d06f776f00fb5f4163dddd32a030c5c20844), [`7e0e63e`](https://github.com/mastra-ai/mastra/commit/7e0e63e2e485e84442351f4c7a79a424c83539dc), [`9467ea8`](https://github.com/mastra-ai/mastra/commit/9467ea87695749a53dfc041576410ebf9ee7bb67), [`7338d94`](https://github.com/mastra-ai/mastra/commit/7338d949380cf68b095342e8e42610dc51d557c1)]:
|
|
12
|
+
- @mastra/core@1.26.0-alpha.2
|
|
13
|
+
|
|
14
|
+
## 1.9.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Fixed double-counting of Anthropic cache tokens in usage metrics ([#15316](https://github.com/mastra-ai/mastra/pull/15316))
|
|
19
|
+
|
|
20
|
+
- Cost estimates now use the latest model pricing rates for more accurate calculations ([#15362](https://github.com/mastra-ai/mastra/pull/15362))
|
|
21
|
+
|
|
22
|
+
- Update references to "Mastra Cloud" to "Mastra platform" ([#15297](https://github.com/mastra-ai/mastra/pull/15297))
|
|
23
|
+
|
|
24
|
+
- Reduced observability overhead for `MODEL_STEP` spans by storing a lightweight message preview of request bodies. ([#15249](https://github.com/mastra-ai/mastra/pull/15249))
|
|
25
|
+
|
|
26
|
+
This keeps span previews readable and avoids pulling large payloads into exporter input.
|
|
27
|
+
|
|
28
|
+
- Fixed cost lookup for models with date suffixes. Providers like OpenAI often return model names with date suffixes (e.g., `gpt-5.4-mini-2026-03-17`) that don't exactly match pricing data entries. The lookup now tries multiple variants including stripping date suffixes and converting dots to dashes. ([#15349](https://github.com/mastra-ai/mastra/pull/15349))
|
|
29
|
+
|
|
30
|
+
- Added `entityVersionId`, `parentEntityVersionId`, and `rootEntityVersionId` to span correlation context, enabling version information to propagate to scores, metrics, logs, and feedback emitted during traced execution. ([#15317](https://github.com/mastra-ai/mastra/pull/15317))
|
|
31
|
+
|
|
32
|
+
- Fixed stack traces for errors reported to Sentry. Exceptions now point to the code that threw the error instead of `SentryExporter.handleSpanEnded` inside the exporter, so issues in Sentry are actually debuggable. ([#15343](https://github.com/mastra-ai/mastra/pull/15343))
|
|
33
|
+
|
|
34
|
+
This was caused by two issues, both fixed:
|
|
35
|
+
- `@mastra/sentry` passed the error message as a string to `Sentry.captureException`, which made Sentry synthesize a stack trace from the exporter's call site. It now passes an `Error` instance with the captured stack attached.
|
|
36
|
+
- `@mastra/observability` stored the wrapping `MastraError`'s stack on the span, hiding the original error's location. When the `MastraError` has a cause, the cause's stack is now preserved.
|
|
37
|
+
|
|
38
|
+
Fixes [#15337](https://github.com/mastra-ai/mastra/issues/15337).
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`87df955`](https://github.com/mastra-ai/mastra/commit/87df955c028660c075873fd5d74af28233ce32eb), [`8fad147`](https://github.com/mastra-ai/mastra/commit/8fad14759804179c8e080ce4d9dec6ef1a808b31), [`582644c`](https://github.com/mastra-ai/mastra/commit/582644c4a87f83b4f245a84d72b9e8590585012e), [`cbdf3e1`](https://github.com/mastra-ai/mastra/commit/cbdf3e12b3d0c30a6e5347be658e2009648c130a), [`8fe46d3`](https://github.com/mastra-ai/mastra/commit/8fe46d354027f3f0f0846e64219772348de106dd), [`18c67db`](https://github.com/mastra-ai/mastra/commit/18c67dbb9c9ebc26f26f65f7d3ff836e5691ef46), [`4ba3bb1`](https://github.com/mastra-ai/mastra/commit/4ba3bb1e465ad2ddaba3bbf2bc47e0faec32985e), [`5d84914`](https://github.com/mastra-ai/mastra/commit/5d84914e0e520c642a40329b210b413fcd139898), [`8dcc77e`](https://github.com/mastra-ai/mastra/commit/8dcc77e78a5340f5848f74b9e9f1b3da3513c1f5), [`aa67fc5`](https://github.com/mastra-ai/mastra/commit/aa67fc59ee8a5eeff1f23eb05970b8d7a536c8ff), [`fd2f314`](https://github.com/mastra-ai/mastra/commit/fd2f31473d3449b6b97e837ef8641264377f41a7), [`fa8140b`](https://github.com/mastra-ai/mastra/commit/fa8140bcd4251d2e3ac85fdc5547dfc4f372b5be), [`190f452`](https://github.com/mastra-ai/mastra/commit/190f45258b0640e2adfc8219fa3258cdc5b8f071), [`e80fead`](https://github.com/mastra-ai/mastra/commit/e80fead1412cc0d1b2f7d6a1ce5017d9e0098ff7), [`0287b64`](https://github.com/mastra-ai/mastra/commit/0287b644a5c3272755cf3112e71338106664103b), [`7e7bf60`](https://github.com/mastra-ai/mastra/commit/7e7bf606886bf374a6f9d4ca9b09dd83d0533372), [`184907d`](https://github.com/mastra-ai/mastra/commit/184907d775d8609c03c26e78ccaf37315f3aa287), [`075e91a`](https://github.com/mastra-ai/mastra/commit/075e91a4549baf46ad7a42a6a8ac8dfa78cc09e6), [`0c4cd13`](https://github.com/mastra-ai/mastra/commit/0c4cd131931c04ac5405373c932a242dbe88edd6), [`b16a753`](https://github.com/mastra-ai/mastra/commit/b16a753d5748440248d7df82e29bb987a9c8386c)]:
|
|
41
|
+
- @mastra/core@1.25.0
|
|
42
|
+
|
|
3
43
|
## 1.9.1-alpha.2
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,O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B,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;YAMR,mBAAmB;IAYjC,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;YAoBP,WAAW;IAoDzB;;OAEG;YACW,WAAW;YAuBX,gBAAgB;IA+B9B,OAAO,CAAC,WAAW;IAUnB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAiChC"}
|
package/dist/index.cjs
CHANGED
|
@@ -15058,7 +15058,6 @@ var SIGNAL_PUBLISH_SEGMENTS = {
|
|
|
15058
15058
|
scores: "scores",
|
|
15059
15059
|
feedback: "feedback"
|
|
15060
15060
|
};
|
|
15061
|
-
var DEFAULT_CLOUD_ENDPOINT = "https://api.mastra.ai";
|
|
15062
15061
|
function trimTrailingSlashes(value) {
|
|
15063
15062
|
let end = value.length;
|
|
15064
15063
|
while (end > 0 && value.charCodeAt(end - 1) === 47) {
|
|
@@ -15187,7 +15186,7 @@ var CloudExporter = class extends BaseExporter {
|
|
|
15187
15186
|
if (tracesEndpointOverride) {
|
|
15188
15187
|
tracesEndpoint = resolveExplicitSignalEndpoint("traces", tracesEndpointOverride, projectId);
|
|
15189
15188
|
} else {
|
|
15190
|
-
baseEndpoint = resolveBaseEndpoint(config2.endpoint ??
|
|
15189
|
+
baseEndpoint = resolveBaseEndpoint(config2.endpoint ?? "https://observability.mastra.ai");
|
|
15191
15190
|
tracesEndpoint = buildSignalEndpoint(baseEndpoint, "traces", projectId);
|
|
15192
15191
|
}
|
|
15193
15192
|
const resolveConfiguredSignalEndpoint = (signal, explicitEndpoint) => {
|
|
@@ -17436,51 +17435,6 @@ function isJsonSchema(val) {
|
|
|
17436
17435
|
}
|
|
17437
17436
|
return false;
|
|
17438
17437
|
}
|
|
17439
|
-
function compressJsonSchema(schema, depth = 0) {
|
|
17440
|
-
if (depth > 3) {
|
|
17441
|
-
return schema.type || "object";
|
|
17442
|
-
}
|
|
17443
|
-
const compositionKeys = ["oneOf", "anyOf", "allOf"].filter((key) => Array.isArray(schema[key]));
|
|
17444
|
-
if (compositionKeys.length > 0) {
|
|
17445
|
-
const compressed2 = {};
|
|
17446
|
-
for (const key of compositionKeys) {
|
|
17447
|
-
compressed2[key] = schema[key].map((entry) => compressJsonSchema(entry, depth + 1));
|
|
17448
|
-
}
|
|
17449
|
-
if (typeof schema.type === "string") {
|
|
17450
|
-
compressed2.type = schema.type;
|
|
17451
|
-
}
|
|
17452
|
-
return compressed2;
|
|
17453
|
-
}
|
|
17454
|
-
if (schema.type !== "object" || !schema.properties) {
|
|
17455
|
-
return schema.type || schema;
|
|
17456
|
-
}
|
|
17457
|
-
const required2 = new Set(Array.isArray(schema.required) ? schema.required : []);
|
|
17458
|
-
const compressed = {};
|
|
17459
|
-
for (const [key, propSchema] of Object.entries(schema.properties)) {
|
|
17460
|
-
const prop = propSchema;
|
|
17461
|
-
let value = prop.type || "unknown";
|
|
17462
|
-
if (prop.type === "object" && prop.properties) {
|
|
17463
|
-
value = compressJsonSchema(prop, depth + 1);
|
|
17464
|
-
if (required2.has(key)) {
|
|
17465
|
-
compressed[key + " (required)"] = value;
|
|
17466
|
-
continue;
|
|
17467
|
-
}
|
|
17468
|
-
} else if (prop.type === "array" && prop.items) {
|
|
17469
|
-
if (prop.items.type === "object" && prop.items.properties) {
|
|
17470
|
-
value = [compressJsonSchema(prop.items, depth + 1)];
|
|
17471
|
-
} else {
|
|
17472
|
-
value = `${prop.items.type || "any"}[]`;
|
|
17473
|
-
}
|
|
17474
|
-
} else if (prop.enum) {
|
|
17475
|
-
value = prop.enum.map((v) => JSON.stringify(v)).join(" | ");
|
|
17476
|
-
}
|
|
17477
|
-
if (required2.has(key) && typeof value === "string") {
|
|
17478
|
-
value += " (required)";
|
|
17479
|
-
}
|
|
17480
|
-
compressed[key] = value;
|
|
17481
|
-
}
|
|
17482
|
-
return compressed;
|
|
17483
|
-
}
|
|
17484
17438
|
function deepClean(value, options = DEFAULT_DEEP_CLEAN_OPTIONS) {
|
|
17485
17439
|
const { keysToStrip, maxDepth, maxStringLength, maxArrayLength, maxObjectKeys } = options;
|
|
17486
17440
|
const stripSet = keysToStrip instanceof Set ? keysToStrip : new Set(Array.isArray(keysToStrip) ? keysToStrip : Object.keys(keysToStrip));
|
|
@@ -17660,11 +17614,7 @@ function deepClean(value, options = DEFAULT_DEEP_CLEAN_OPTIONS) {
|
|
|
17660
17614
|
looksLikeJsonSchema = false;
|
|
17661
17615
|
}
|
|
17662
17616
|
if (looksLikeJsonSchema) {
|
|
17663
|
-
|
|
17664
|
-
const compressed = compressJsonSchema(val);
|
|
17665
|
-
return compressed === val ? "[JSONSchema]" : helper(compressed, depth);
|
|
17666
|
-
} catch {
|
|
17667
|
-
}
|
|
17617
|
+
return val;
|
|
17668
17618
|
}
|
|
17669
17619
|
const cleaned = {};
|
|
17670
17620
|
const keys = Object.keys(val).filter((key) => !stripSet.has(key));
|
|
@@ -18767,6 +18717,9 @@ function summarizeRequestBody(body) {
|
|
|
18767
18717
|
if (Array.isArray(body.messages)) {
|
|
18768
18718
|
return normalizeMessages(body.messages);
|
|
18769
18719
|
}
|
|
18720
|
+
if (Array.isArray(body.input)) {
|
|
18721
|
+
return normalizeMessages(body.input);
|
|
18722
|
+
}
|
|
18770
18723
|
if (Array.isArray(body.contents)) {
|
|
18771
18724
|
return body.contents.map((item) => ({
|
|
18772
18725
|
role: typeof item?.role === "string" ? item.role : "user",
|