@mastra/observability 1.10.1 → 1.10.2
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 +18 -0
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/usage.d.ts +3 -2
- package/dist/usage.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -18533,6 +18533,9 @@ function extractUsageMetrics(usage, providerMetadata) {
|
|
|
18533
18533
|
if (!isDefined(inputDetails.cacheRead) && isDefined(usage.cachedInputTokens)) {
|
|
18534
18534
|
inputDetails.cacheRead = usage.cachedInputTokens;
|
|
18535
18535
|
}
|
|
18536
|
+
if (!isDefined(inputDetails.cacheWrite) && isDefined(usage.cacheCreationInputTokens)) {
|
|
18537
|
+
inputDetails.cacheWrite = usage.cacheCreationInputTokens;
|
|
18538
|
+
}
|
|
18536
18539
|
if (isDefined(usage.reasoningTokens)) {
|
|
18537
18540
|
outputDetails.reasoning = usage.reasoningTokens;
|
|
18538
18541
|
}
|
|
@@ -18546,7 +18549,7 @@ function extractUsageMetrics(usage, providerMetadata) {
|
|
|
18546
18549
|
if (!isDefined(inputDetails.cacheWrite) && isDefined(anthropic.cacheCreationInputTokens)) {
|
|
18547
18550
|
inputDetails.cacheWrite = anthropic.cacheCreationInputTokens;
|
|
18548
18551
|
}
|
|
18549
|
-
const inputAlreadyIncludesCache = hasV3CachedTotals || isDefined(usage.cachedInputTokens) && usage.cachedInputTokens > 0;
|
|
18552
|
+
const inputAlreadyIncludesCache = hasV3CachedTotals || isDefined(usage.cachedInputTokens) && usage.cachedInputTokens > 0 || isDefined(usage.cacheCreationInputTokens) && usage.cacheCreationInputTokens > 0;
|
|
18550
18553
|
if (!inputAlreadyIncludesCache && (isDefined(inputDetails.cacheRead) || isDefined(inputDetails.cacheWrite))) {
|
|
18551
18554
|
inputTokens = (usage.inputTokens ?? 0) + (inputDetails.cacheRead ?? 0) + (inputDetails.cacheWrite ?? 0);
|
|
18552
18555
|
}
|