Skip to content

feat(llmobs): support custom telemetry metadata in Vercel AI SDK spans#7556

Merged
sabrenner merged 22 commits intomasterfrom
sabrenner/port-7322
Apr 9, 2026
Merged

feat(llmobs): support custom telemetry metadata in Vercel AI SDK spans#7556
sabrenner merged 22 commits intomasterfrom
sabrenner/port-7322

Conversation

@sabrenner
Copy link
Copy Markdown
Collaborator

What does this PR do?

Closes #7322 (by porting its commits and cleaning it up)

Motivation

Adds support for recording telemetry metadata for Vercel AI SDK telemetry on Datadog LLM Observability span events' metadata field.

isaacwasserman and others added 5 commits February 17, 2026 14:45
Add getTelemetryMetadata function to extract custom metadata from
ai.telemetry.metadata.* attributes and include them in LLMObs span
metadata for text generation, object generation, and embedding
workflow operations.
Co-authored-by: Sam Brenner <106700075+sabrenner@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 17, 2026

Overall package size

Self size: 5.47 MB
Deduped: 6.32 MB
No deduping: 6.32 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 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
Copy Markdown

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.87%. Comparing base (9ed88dc) to head (f3ae286).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7556      +/-   ##
==========================================
+ Coverage   73.85%   73.87%   +0.02%     
==========================================
  Files         773      773              
  Lines       35959    35985      +26     
==========================================
+ Hits        26558    26585      +27     
+ Misses       9401     9400       -1     
Flag Coverage Δ
aiguard-macos 36.39% <ø> (-0.09%) ⬇️
aiguard-ubuntu 36.50% <ø> (-0.09%) ⬇️
aiguard-windows 36.29% <ø> (-0.09%) ⬇️
apm-capabilities-tracing-macos 48.80% <7.89%> (-0.04%) ⬇️
apm-capabilities-tracing-ubuntu 48.84% <7.89%> (-0.04%) ⬇️
apm-capabilities-tracing-windows 48.62% <7.89%> (-0.04%) ⬇️
apm-integrations-child-process 36.03% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-18 34.97% <ø> (-0.09%) ⬇️
apm-integrations-couchbase-eol 35.03% <ø> (-0.09%) ⬇️
apm-integrations-oracledb 35.03% <ø> (-0.09%) ⬇️
appsec-express 52.88% <ø> (-0.04%) ⬇️
appsec-fastify 49.33% <ø> (-0.07%) ⬇️
appsec-graphql 49.57% <ø> (-0.16%) ⬇️
appsec-kafka 42.09% <ø> (-0.08%) ⬇️
appsec-ldapjs 41.41% <ø> (-0.08%) ⬇️
appsec-lodash 41.44% <ø> (-0.08%) ⬇️
appsec-macos 56.78% <ø> (-0.07%) ⬇️
appsec-mongodb-core 46.05% <ø> (-0.07%) ⬇️
appsec-mongoose 46.65% <ø> (-0.07%) ⬇️
appsec-mysql 48.79% <ø> (-0.07%) ⬇️
appsec-node-serialize 40.60% <ø> (-0.08%) ⬇️
appsec-passport 44.62% <ø> (-0.08%) ⬇️
appsec-postgres 48.37% <ø> (-0.19%) ⬇️
appsec-sourcing 40.06% <ø> (-0.08%) ⬇️
appsec-stripe 42.32% <ø> (-0.08%) ⬇️
appsec-template 40.77% <ø> (-0.08%) ⬇️
appsec-ubuntu 56.86% <ø> (-0.07%) ⬇️
appsec-windows 56.67% <ø> (-0.05%) ⬇️
instrumentations-instrumentation-bluebird 29.90% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-body-parser 37.65% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-child_process 35.41% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-cookie-parser 31.84% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express 32.14% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 31.97% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-session 37.31% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-fs 29.54% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-generic-pool 31.44% <ø> (ø)
instrumentations-instrumentation-http 36.86% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-knex 29.92% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mongoose 31.03% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-multer 37.42% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-mysql2 35.39% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport 41.24% <ø> (-0.08%) ⬇️
instrumentations-instrumentation-passport-http 40.94% <ø> (-0.08%) ⬇️
instrumentations-instrumentation-passport-local 41.43% <ø> (-0.08%) ⬇️
instrumentations-instrumentation-pg 34.89% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-promise 29.84% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise-js 29.84% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-q 29.88% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-url 29.81% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-when 29.85% <ø> (-0.10%) ⬇️
llmobs-ai 38.41% <100.00%> (+0.04%) ⬆️
llmobs-anthropic 37.87% <ø> (-0.09%) ⬇️
llmobs-bedrock 37.16% <ø> (-0.08%) ⬇️
llmobs-google-genai 37.55% <ø> (-0.08%) ⬇️
llmobs-langchain 37.06% <ø> (-0.07%) ⬇️
llmobs-openai 41.24% <ø> (-0.08%) ⬇️
llmobs-vertex-ai 37.72% <ø> (-0.09%) ⬇️
platform-core 30.82% <ø> (ø)
platform-esbuild 33.74% <ø> (ø)
platform-instrumentations-misc 40.89% <ø> (ø)
platform-shimmer 36.80% <ø> (ø)
platform-unit-guardrails 32.24% <ø> (ø)
platform-webpack 20.96% <ø> (ø)
plugins-azure-durable-functions 25.38% <ø> (ø)
plugins-azure-event-hubs 25.53% <ø> (ø)
plugins-azure-service-bus 24.92% <ø> (ø)
plugins-bullmq 40.70% <ø> (-0.09%) ⬇️
plugins-cassandra 35.18% <ø> (-0.09%) ⬇️
plugins-cookie 26.56% <ø> (ø)
plugins-cookie-parser 26.35% <ø> (ø)
plugins-crypto 26.21% <ø> (ø)
plugins-dd-trace-api 35.39% <ø> (-0.10%) ⬇️
plugins-express-mongo-sanitize 26.50% <ø> (ø)
plugins-express-session 26.31% <ø> (ø)
plugins-fastify 39.43% <ø> (-0.09%) ⬇️
plugins-fetch 35.69% <ø> (-0.09%) ⬇️
plugins-fs 35.63% <ø> (-0.10%) ⬇️
plugins-generic-pool 25.57% <ø> (ø)
plugins-google-cloud-pubsub 43.02% <ø> (-0.08%) ⬇️
plugins-grpc 38.04% <ø> (-0.09%) ⬇️
plugins-handlebars 26.54% <ø> (ø)
plugins-hapi 37.23% <ø> (-0.09%) ⬇️
plugins-hono 37.52% <ø> (-0.09%) ⬇️
plugins-ioredis 35.60% <ø> (-0.09%) ⬇️
plugins-knex 26.20% <ø> (ø)
plugins-langgraph 35.08% <ø> (-0.09%) ⬇️
plugins-ldapjs 24.12% <ø> (ø)
plugins-light-my-request 25.93% <ø> (ø)
plugins-limitd-client 30.16% <ø> (-0.10%) ⬇️
plugins-lodash 25.66% <ø> (ø)
plugins-mariadb 36.50% <ø> (-0.09%) ⬇️
plugins-memcached 35.26% <ø> (-0.09%) ⬇️
plugins-microgateway-core 36.36% <ø> (-0.09%) ⬇️
plugins-moleculer 38.03% <ø> (-0.09%) ⬇️
plugins-mongodb 36.37% <ø> (-0.09%) ⬇️
plugins-mongodb-core 36.07% <ø> (-0.12%) ⬇️
plugins-mongoose 36.05% <ø> (-0.09%) ⬇️
plugins-multer 26.31% <ø> (ø)
plugins-mysql 36.34% <ø> (-0.09%) ⬇️
plugins-mysql2 36.34% <ø> (-0.09%) ⬇️
plugins-node-serialize 26.60% <ø> (ø)
plugins-opensearch 34.93% <ø> (-0.09%) ⬇️
plugins-passport-http 26.37% <ø> (ø)
plugins-postgres 34.32% <ø> (-0.11%) ⬇️
plugins-process 26.21% <ø> (ø)
plugins-pug 26.56% <ø> (ø)
plugins-redis 35.91% <ø> (-0.09%) ⬇️
plugins-router 40.00% <ø> (-0.09%) ⬇️
plugins-sequelize 25.19% <ø> (ø)
plugins-test-and-upstream-amqp10 35.62% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-amqplib 40.82% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-apollo 36.53% <ø> (-0.08%) ⬇️
plugins-test-and-upstream-avsc 35.63% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-bunyan 31.27% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-connect 37.84% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-graphql 37.17% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-koa 37.49% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-protobufjs 35.84% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-rhea 40.93% <ø> (-0.09%) ⬇️
plugins-undici 36.59% <ø> (-0.09%) ⬇️
plugins-url 26.21% <ø> (ø)
plugins-valkey 35.28% <ø> (-0.09%) ⬇️
plugins-vm 26.21% <ø> (ø)
plugins-winston 31.59% <ø> (-0.09%) ⬇️
plugins-ws 38.93% <ø> (-0.09%) ⬇️
profiling-macos 38.45% <ø> (+0.30%) ⬆️
profiling-ubuntu 38.22% <ø> (-0.09%) ⬇️
profiling-windows 39.53% <ø> (-0.09%) ⬇️
serverless-azure-functions-client 25.26% <ø> (ø)
serverless-azure-functions-eventhubs 25.26% <ø> (ø)
serverless-azure-functions-servicebus 25.26% <ø> (ø)

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.

@sabrenner sabrenner marked this pull request as ready for review February 17, 2026 20:33
@sabrenner sabrenner requested a review from a team as a code owner February 17, 2026 20:33
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Feb 17, 2026

Benchmarks

Benchmark execution time: 2026-04-09 13:38:30

Comparing candidate commit f3ae286 in PR branch sabrenner/port-7322 with baseline commit 9ed88dc in branch master.

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

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 bot commented Feb 18, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 84.21%
Overall Coverage: 68.29% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f3ae286 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

BridgeAR
BridgeAR previously approved these changes Mar 6, 2026
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I just left a few suggestions for a faster implementation. There is still a bit of code duplication, while abstracting these would likely not improve much, so I think that is good as is.

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
@sabrenner sabrenner enabled auto-merge (squash) April 9, 2026 17:22
@sabrenner sabrenner merged commit 70baebd into master Apr 9, 2026
1054 of 1324 checks passed
@sabrenner sabrenner deleted the sabrenner/port-7322 branch April 9, 2026 17:24
dd-octo-sts bot pushed a commit that referenced this pull request Apr 10, 2026
#7556)

* feat(llmobs): support custom telemetry metadata in Vercel AI SDK spans

Add getTelemetryMetadata function to extract custom metadata from
ai.telemetry.metadata.* attributes and include them in LLMObs span
metadata for text generation, object generation, and embedding
workflow operations.

* Update packages/dd-trace/src/llmobs/plugins/ai/util.js

Co-authored-by: Sam Brenner <106700075+sabrenner@users.noreply.github.com>

* source cleanups

* test cleanups

* minor cleanup

* review comments

* Update packages/dd-trace/src/llmobs/plugins/ai/util.js

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update packages/dd-trace/src/llmobs/plugins/ai/util.js

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* fmt

* apply review changes

---------

Co-authored-by: Isaac Wasserman <isaacrwasserman@gmail.com>
Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
@dd-octo-sts dd-octo-sts bot mentioned this pull request Apr 10, 2026
juan-fernandez pushed a commit that referenced this pull request Apr 10, 2026
#7556)

* feat(llmobs): support custom telemetry metadata in Vercel AI SDK spans

Add getTelemetryMetadata function to extract custom metadata from
ai.telemetry.metadata.* attributes and include them in LLMObs span
metadata for text generation, object generation, and embedding
workflow operations.

* Update packages/dd-trace/src/llmobs/plugins/ai/util.js

Co-authored-by: Sam Brenner <106700075+sabrenner@users.noreply.github.com>

* source cleanups

* test cleanups

* minor cleanup

* review comments

* Update packages/dd-trace/src/llmobs/plugins/ai/util.js

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* Update packages/dd-trace/src/llmobs/plugins/ai/util.js

Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>

* fmt

* apply review changes

---------

Co-authored-by: Isaac Wasserman <isaacrwasserman@gmail.com>
Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
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.

3 participants