Skip to content

feat(anthropic, llmobs): report prompt cache ttl write tokens#7779

Merged
Yun-Kim merged 1 commit intomasterfrom
yunkim/llmobs-anthropic-cache-metrics
Mar 13, 2026
Merged

feat(anthropic, llmobs): report prompt cache ttl write tokens#7779
Yun-Kim merged 1 commit intomasterfrom
yunkim/llmobs-anthropic-cache-metrics

Conversation

@Yun-Kim
Copy link
Contributor

@Yun-Kim Yun-Kim commented Mar 13, 2026

What does this PR do?

Reports ephemeral_5m/1h_input_tokens from anthropic LLM calls onto LLMObs spans.

Motivation

Additional Notes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Overall package size

Self size: 4.97 MB
Deduped: 5.81 MB
No deduping: 5.81 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.42%. Comparing base (f31802d) to head (7819367).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
packages/dd-trace/src/llmobs/plugins/anthropic.js 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7779      +/-   ##
==========================================
- Coverage   80.42%   80.42%   -0.01%     
==========================================
  Files         741      741              
  Lines       32168    32193      +25     
==========================================
+ Hits        25872    25891      +19     
- Misses       6296     6302       +6     
Flag Coverage Δ
aiguard-macos 39.08% <0.00%> (+0.14%) ⬆️
aiguard-ubuntu 39.19% <0.00%> (+0.14%) ⬆️
aiguard-windows 38.92% <0.00%> (+0.14%) ⬆️
apm-capabilities-tracing-macos 48.87% <0.00%> (-0.02%) ⬇️
apm-capabilities-tracing-ubuntu 48.91% <0.00%> (-0.02%) ⬇️
apm-capabilities-tracing-windows 48.64% <0.00%> (-0.02%) ⬇️
apm-integrations-child-process 38.38% <0.00%> (-0.12%) ⬇️
apm-integrations-couchbase-18 37.33% <0.00%> (-0.08%) ⬇️
apm-integrations-couchbase-eol 37.76% <0.00%> (-0.14%) ⬇️
apm-integrations-oracledb 37.60% <0.00%> (-0.11%) ⬇️
appsec-express 55.18% <0.00%> (-0.09%) ⬇️
appsec-fastify 51.53% <0.00%> (-0.09%) ⬇️
appsec-graphql 51.73% <0.00%> (-0.08%) ⬇️
appsec-kafka 44.25% <0.00%> (-0.10%) ⬇️
appsec-ldapjs 43.91% <0.00%> (-0.10%) ⬇️
appsec-lodash 43.57% <0.00%> (-0.10%) ⬇️
appsec-macos 58.20% <0.00%> (-0.08%) ⬇️
appsec-mongodb-core 48.69% <0.00%> (-0.10%) ⬇️
appsec-mongoose 49.35% <0.00%> (-0.09%) ⬇️
appsec-mysql 50.79% <0.00%> (-0.19%) ⬇️
appsec-node-serialize 43.09% <0.00%> (-0.10%) ⬇️
appsec-passport 47.53% <0.00%> (-0.10%) ⬇️
appsec-postgres 50.51% <0.00%> (-0.11%) ⬇️
appsec-sourcing 42.50% <0.00%> (-0.10%) ⬇️
appsec-template 43.26% <0.00%> (-0.10%) ⬇️
appsec-ubuntu 58.27% <0.00%> (-0.08%) ⬇️
appsec-windows 58.06% <0.00%> (-0.08%) ⬇️
instrumentations-instrumentation-bluebird 32.25% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-body-parser 40.40% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-child_process 37.69% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-cookie-parser 34.23% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-express 34.55% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.36% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-express-session 40.03% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-fs 31.87% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-generic-pool 29.69% <ø> (ø)
instrumentations-instrumentation-http 39.67% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-knex 32.25% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-mongoose 33.38% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-multer 40.15% <0.00%> (-0.11%) ⬇️
instrumentations-instrumentation-mysql2 38.15% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-passport 43.96% <0.00%> (-0.10%) ⬇️
instrumentations-instrumentation-passport-http 43.62% <0.00%> (-0.10%) ⬇️
instrumentations-instrumentation-passport-local 44.16% <0.00%> (-0.10%) ⬇️
instrumentations-instrumentation-pg 37.59% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-promise 32.18% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-promise-js 32.19% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-q 32.23% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-url 32.15% <0.00%> (-0.12%) ⬇️
instrumentations-instrumentation-when 32.20% <0.00%> (-0.12%) ⬇️
llmobs-ai 42.14% <0.00%> (-0.11%) ⬇️
llmobs-anthropic 40.17% <72.72%> (-0.06%) ⬇️
llmobs-bedrock 39.12% <0.00%> (-0.10%) ⬇️
llmobs-google-genai 39.67% <0.00%> (-0.10%) ⬇️
llmobs-langchain 39.90% <0.00%> (-0.22%) ⬇️
llmobs-openai 43.86% <0.00%> (-0.10%) ⬇️
llmobs-vertex-ai 39.86% <0.00%> (-0.18%) ⬇️
platform-core 31.53% <ø> (ø)
platform-esbuild 34.48% <ø> (ø)
platform-instrumentations-misc 48.40% <ø> (ø)
platform-shimmer 37.63% <ø> (ø)
platform-unit-guardrails 32.95% <ø> (ø)
plugins-azure-event-hubs 25.83% <ø> (ø)
plugins-azure-service-bus 25.19% <ø> (ø)
plugins-bullmq 44.06% <0.00%> (-0.10%) ⬇️
plugins-cassandra 37.64% <0.00%> (-0.11%) ⬇️
plugins-cookie 26.89% <ø> (ø)
plugins-cookie-parser 26.67% <ø> (ø)
plugins-crypto 26.79% <ø> (ø)
plugins-dd-trace-api 38.21% <0.00%> (-0.12%) ⬇️
plugins-express-mongo-sanitize 26.82% <ø> (ø)
plugins-express-session 26.63% <ø> (ø)
plugins-fastify 42.11% <0.00%> (-0.11%) ⬇️
plugins-fetch 38.21% <0.00%> (-0.11%) ⬇️
plugins-fs 38.48% <0.00%> (-0.12%) ⬇️
plugins-generic-pool 25.87% <ø> (ø)
plugins-google-cloud-pubsub 45.33% <0.00%> (-0.09%) ⬇️
plugins-grpc 40.79% <0.00%> (-0.11%) ⬇️
plugins-handlebars 26.86% <ø> (ø)
plugins-hapi 40.03% <0.00%> (-0.11%) ⬇️
plugins-hono 40.29% <0.00%> (-0.11%) ⬇️
plugins-ioredis 38.29% <0.00%> (-0.12%) ⬇️
plugins-knex 26.50% <ø> (ø)
plugins-ldapjs 24.36% <ø> (ø)
plugins-light-my-request 26.23% <ø> (ø)
plugins-limitd-client 32.53% <0.00%> (-0.12%) ⬇️
plugins-lodash 25.96% <ø> (ø)
plugins-mariadb 39.34% <0.00%> (-0.16%) ⬇️
plugins-memcached 38.01% <0.00%> (-0.12%) ⬇️
plugins-microgateway-core 39.10% <0.00%> (-0.11%) ⬇️
plugins-moleculer 40.39% <0.00%> (-0.11%) ⬇️
plugins-mongodb 39.03% <0.00%> (-0.11%) ⬇️
plugins-mongodb-core 38.86% <0.00%> (-0.11%) ⬇️
plugins-mongoose 38.72% <0.00%> (-0.11%) ⬇️
plugins-multer 26.63% <ø> (ø)
plugins-mysql 39.02% <0.00%> (-0.12%) ⬇️
plugins-mysql2 39.12% <0.00%> (-0.11%) ⬇️
plugins-node-serialize 26.93% <ø> (ø)
plugins-opensearch 37.47% <0.00%> (-0.12%) ⬇️
plugins-passport-http 26.68% <ø> (ø)
plugins-postgres 35.52% <0.00%> (-0.10%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 26.89% <ø> (ø)
plugins-redis 38.75% <0.00%> (-0.12%) ⬇️
plugins-router 42.97% <0.00%> (+0.02%) ⬆️
plugins-sequelize 25.47% <ø> (ø)
plugins-test-and-upstream-amqp10 38.37% <0.00%> (-0.12%) ⬇️
plugins-test-and-upstream-amqplib 43.75% <0.00%> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.00% <0.00%> (-0.10%) ⬇️
plugins-test-and-upstream-avsc 38.54% <0.00%> (-0.12%) ⬇️
plugins-test-and-upstream-bunyan 33.79% <0.00%> (-0.12%) ⬇️
plugins-test-and-upstream-connect 40.69% <0.00%> (-0.11%) ⬇️
plugins-test-and-upstream-graphql 39.98% <0.00%> (-0.11%) ⬇️
plugins-test-and-upstream-koa 40.28% <0.00%> (-0.11%) ⬇️
plugins-test-and-upstream-protobufjs 38.76% <0.00%> (-0.12%) ⬇️
plugins-test-and-upstream-rhea 43.92% <0.00%> (-0.09%) ⬇️
plugins-undici 38.98% <0.00%> (-0.11%) ⬇️
plugins-url 26.79% <ø> (ø)
plugins-valkey 37.96% <0.00%> (-0.12%) ⬇️
plugins-vm 26.79% <ø> (ø)
plugins-winston 33.98% <0.00%> (-0.11%) ⬇️
plugins-ws 41.74% <0.00%> (-0.11%) ⬇️
profiling-macos 39.79% <0.00%> (-0.12%) ⬇️
profiling-ubuntu 39.91% <0.00%> (-0.12%) ⬇️
profiling-windows 41.10% <0.00%> (-0.11%) ⬇️
serverless-azure-functions-client 25.54% <ø> (ø)
serverless-azure-functions-eventhubs 25.54% <ø> (ø)
serverless-azure-functions-servicebus 25.54% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-official

This comment has been minimized.

@Yun-Kim Yun-Kim marked this pull request as ready for review March 13, 2026 19:19
@Yun-Kim Yun-Kim requested a review from a team as a code owner March 13, 2026 19:19
@Yun-Kim Yun-Kim force-pushed the yunkim/llmobs-anthropic-cache-metrics branch from 6102c26 to 7819367 Compare March 13, 2026 19:23
@pr-commenter
Copy link

pr-commenter bot commented Mar 13, 2026

Benchmarks

Benchmark execution time: 2026-03-13 19:33:19

Comparing candidate commit 7819367 in PR branch yunkim/llmobs-anthropic-cache-metrics with baseline commit f31802d in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 229 metrics, 31 unstable metrics.

@Yun-Kim Yun-Kim enabled auto-merge (squash) March 13, 2026 21:21
@Yun-Kim Yun-Kim merged commit d1b3492 into master Mar 13, 2026
789 of 790 checks passed
@Yun-Kim Yun-Kim deleted the yunkim/llmobs-anthropic-cache-metrics branch March 13, 2026 21:22
@dd-octo-sts dd-octo-sts bot mentioned this pull request Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants