@mastra/observability 1.9.0 → 1.9.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,20 @@
1
1
  # @mastra/observability
2
2
 
3
+ ## 1.9.1-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed double-counting of Anthropic cache tokens in usage metrics ([#15316](https://github.com/mastra-ai/mastra/pull/15316))
8
+
9
+ ## 1.9.1-alpha.0
10
+
11
+ ### Patch Changes
12
+
13
+ - Update references to "Mastra Cloud" to "Mastra platform" ([#15297](https://github.com/mastra-ai/mastra/pull/15297))
14
+
15
+ - Updated dependencies [[`4ba3bb1`](https://github.com/mastra-ai/mastra/commit/4ba3bb1e465ad2ddaba3bbf2bc47e0faec32985e)]:
16
+ - @mastra/core@1.25.0-alpha.2
17
+
3
18
  ## 1.9.0
4
19
 
5
20
  ### Minor Changes
package/README.md CHANGED
@@ -21,7 +21,7 @@ export const mastra = new Mastra({
21
21
  serviceName: 'my-app',
22
22
  exporters: [
23
23
  new DefaultExporter(), // Persists traces for Mastra Studio
24
- new CloudExporter(), // Sends to Mastra Cloud
24
+ new CloudExporter(), // Sends to Mastra platform
25
25
  ],
26
26
  spanOutputProcessors: [new SensitiveDataFilter()],
27
27
  },
@@ -33,7 +33,7 @@ export const mastra = new Mastra({
33
33
  ## Features
34
34
 
35
35
  - **Auto-instrumentation** - Traces agent runs, LLM calls, tool executions, and workflows
36
- - **Pluggable Exporters** - Exporters for Studio and Cloud, plus integrations for Arize, Braintrust, Langfuse, LangSmith, and OpenTelemetry
36
+ - **Pluggable Exporters** - Exporters for Studio, plus integrations for Arize, Braintrust, Langfuse, LangSmith, and OpenTelemetry
37
37
  - **Sampling Strategies** - Always, ratio-based, or custom sampling
38
38
  - **Span Processors** - Transform or filter span data before export
39
39
  - **OpenTelemetry Compatible** - Standard trace/span ID formats for integration
package/dist/index.cjs CHANGED
@@ -18594,7 +18594,8 @@ function extractUsageMetrics(usage, providerMetadata) {
18594
18594
  if (!isDefined(inputDetails.cacheWrite) && isDefined(anthropic.cacheCreationInputTokens)) {
18595
18595
  inputDetails.cacheWrite = anthropic.cacheCreationInputTokens;
18596
18596
  }
18597
- if (!hasV3CachedTotals && (isDefined(inputDetails.cacheRead) || isDefined(inputDetails.cacheWrite))) {
18597
+ const inputAlreadyIncludesCache = hasV3CachedTotals || isDefined(usage.cachedInputTokens) && usage.cachedInputTokens > 0;
18598
+ if (!inputAlreadyIncludesCache && (isDefined(inputDetails.cacheRead) || isDefined(inputDetails.cacheWrite))) {
18598
18599
  inputTokens = (usage.inputTokens ?? 0) + (inputDetails.cacheRead ?? 0) + (inputDetails.cacheWrite ?? 0);
18599
18600
  }
18600
18601
  }