@mastra/observability 1.16.1-alpha.0 → 1.16.1-alpha.1

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @mastra/observability
2
2
 
3
+ ## 1.16.1-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed cost estimation for Amazon Bedrock inference profiles, including geographic prefixes and versioned model IDs. ([#19360](https://github.com/mastra-ai/mastra/pull/19360))
8
+
9
+ - Added PROVIDER_TOOL_CALL to exporter span-type mappings and duration metrics so provider-executed tool spans are classified as tool spans across all observability platforms. ([#19261](https://github.com/mastra-ai/mastra/pull/19261))
10
+
11
+ - Updated dependencies [[`25e7c12`](https://github.com/mastra-ai/mastra/commit/25e7c126a770069ae7fb7ecf1d2adb40e017b009), [`1ce5121`](https://github.com/mastra-ai/mastra/commit/1ce512155d122bb21f47d98383e82ffbf84b39e8), [`3cfc47a`](https://github.com/mastra-ai/mastra/commit/3cfc47a6b89940aadd0f46fb01ae9624a73a865d), [`2bb7817`](https://github.com/mastra-ai/mastra/commit/2bb78176112fde628483de2830528f7eee911e56), [`51d9870`](https://github.com/mastra-ai/mastra/commit/51d987032c689c2855374d0f244f5d654da809d1), [`5cab274`](https://github.com/mastra-ai/mastra/commit/5cab2744250e22d12fefa7b32637dce224233cee), [`7fa27d3`](https://github.com/mastra-ai/mastra/commit/7fa27d3b6f5ed68cd34e454a4d3ad9c482a0cfbc), [`a58dcbb`](https://github.com/mastra-ai/mastra/commit/a58dcbb546d7e1d65ebdc1f39e55f0908fcd9391), [`153bd3b`](https://github.com/mastra-ai/mastra/commit/153bd3b396bdfed6b74cf43de12db8fd2d83c04a), [`07bb863`](https://github.com/mastra-ai/mastra/commit/07bb8631919c6f7cf377dccd45b096e0f17fbed0), [`8a586ec`](https://github.com/mastra-ai/mastra/commit/8a586eca9a4914f31dff6140d0d45ac375b00669), [`3927473`](https://github.com/mastra-ai/mastra/commit/392747323ddb10c643d12be7b9ae913159dfaeed), [`dce50dc`](https://github.com/mastra-ai/mastra/commit/dce50dc9a1c1fcd0f427bb5f6250ec74910cb04b), [`634caff`](https://github.com/mastra-ai/mastra/commit/634caff29a9200ad058b67d53f96d9e5832fb8a2)]:
12
+ - @mastra/core@1.51.0-alpha.7
13
+
3
14
  ## 1.16.1-alpha.0
4
15
 
5
16
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1006,6 +1006,7 @@ var PricingModel = class {
1006
1006
 
1007
1007
  // src/metrics/pricing-registry.ts
1008
1008
  var DATA_FILE_NAME = "pricing-data.jsonl";
1009
+ var BEDROCK_GEOGRAPHY_PREFIXES = /* @__PURE__ */ new Set(["global", "us", "eu", "apac", "jp", "au"]);
1009
1010
  var MINIFIED_METER_TO_CANONICAL = {
1010
1011
  it: "input_tokens",
1011
1012
  ot: "output_tokens",
@@ -1040,7 +1041,7 @@ var PricingRegistry = class _PricingRegistry {
1040
1041
  return _PricingRegistry.globalRegistry;
1041
1042
  }
1042
1043
  get(args) {
1043
- const variants = getModelVariants(args.model);
1044
+ const variants = getModelVariants(args.model, normalizeProvider(args.provider));
1044
1045
  for (const variant of variants) {
1045
1046
  const key = makePricingKey({ provider: args.provider, model: variant });
1046
1047
  const match = this.pricingModels.get(key);
@@ -1134,7 +1135,7 @@ function normalizeProvider(provider) {
1134
1135
  const dotIndex = normalized.indexOf(".");
1135
1136
  return dotIndex !== -1 ? normalized.substring(0, dotIndex) : normalized;
1136
1137
  }
1137
- function getModelVariants(model) {
1138
+ function getModelVariants(model, provider) {
1138
1139
  const variants = /* @__PURE__ */ new Set();
1139
1140
  const add = (v) => {
1140
1141
  variants.add(v);
@@ -1149,6 +1150,22 @@ function getModelVariants(model) {
1149
1150
  add(withoutVendor);
1150
1151
  add(withoutVendor.replace(/\./g, "-"));
1151
1152
  }
1153
+ if (provider === "amazon-bedrock") {
1154
+ const addBedrockVariant = (v) => {
1155
+ add(v);
1156
+ add(v.replace(/-(?:v)?\d+(?::\d+)?$/, ""));
1157
+ };
1158
+ const segments = model.split(".");
1159
+ const withoutGeography = BEDROCK_GEOGRAPHY_PREFIXES.has(segments[0] ?? "") ? segments.slice(1).join(".") : model;
1160
+ addBedrockVariant(withoutGeography);
1161
+ addBedrockVariant(withoutGeography.replace(/\./g, "-"));
1162
+ const vendorSeparator = withoutGeography.indexOf(".");
1163
+ if (vendorSeparator !== -1) {
1164
+ const withoutVendor = withoutGeography.substring(vendorSeparator + 1);
1165
+ addBedrockVariant(withoutVendor);
1166
+ addBedrockVariant(withoutVendor.replace(/\./g, "-"));
1167
+ }
1168
+ }
1152
1169
  return [...variants];
1153
1170
  }
1154
1171
  function stripDateSuffix(model) {
@@ -1513,6 +1530,7 @@ function getDurationMetricName(span) {
1513
1530
  return "mastra_agent_duration_ms";
1514
1531
  case observability.SpanType.TOOL_CALL:
1515
1532
  case observability.SpanType.MCP_TOOL_CALL:
1533
+ case observability.SpanType.PROVIDER_TOOL_CALL:
1516
1534
  return "mastra_tool_duration_ms";
1517
1535
  case observability.SpanType.CLIENT_TOOL_CALL:
1518
1536
  return null;
@@ -2472,6 +2490,7 @@ function isSpanInternal(spanType, flags) {
2472
2490
  // Tool-related spans
2473
2491
  case observability.SpanType.TOOL_CALL:
2474
2492
  case observability.SpanType.MCP_TOOL_CALL:
2493
+ case observability.SpanType.PROVIDER_TOOL_CALL:
2475
2494
  return (flags & observability.InternalSpans.TOOL) !== 0;
2476
2495
  // Model-related spans
2477
2496
  case observability.SpanType.MODEL_GENERATION: