Skip to content

feat(llmobs): sampling decisions, rates, and propagation#9030

Merged
Yun-Kim merged 13 commits into
masterfrom
yunkim/llmobs-sampling
Jun 26, 2026
Merged

feat(llmobs): sampling decisions, rates, and propagation#9030
Yun-Kim merged 13 commits into
masterfrom
yunkim/llmobs-sampling

Conversation

@Yun-Kim

@Yun-Kim Yun-Kim commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Make and record LLMO sampling decisions on LLMO spans (always ship, we drop in the backend). Allow users to set via DD_LLMOBS_SAMPLE_RATE or via tracer.init({ llmobs: {sampleRate: ...} })

  • Keep/drop decision + rate computed once on the root span, inherited by descendants and across services.
  • Propagated via x-datadog-tags (_dd.p.llmobs_sr / _dd.p.llmobs_sd).

Claude session: 1688bbe5-066d-47dc-ae28-8678aef20ee2
Resume: claude --resume 1688bbe5-066d-47dc-ae28-8678aef20ee2

🤖 Generated with Claude Code

Compute a keep/drop decision + rate once on the root LLMObs span and
inherit it across spans and services (via x-datadog-tags). Spans are
always shipped; the decision is recorded in the event _dd block so the
backend can honor it. Mirrors dd-trace-py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jun 22, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ff8b677 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.36 MB
Deduped: 7.42 MB
No deduping: 7.42 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.2.0 | 104.26 kB | 843.44 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

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

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.27%. Comparing base (ccbc9d2) to head (ff8b677).
⚠️ Report is 40 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9030      +/-   ##
==========================================
+ Coverage   91.93%   93.27%   +1.33%     
==========================================
  Files         879      886       +7     
  Lines       50491    50803     +312     
  Branches     9942    10006      +64     
==========================================
+ Hits        46421    47387     +966     
+ Misses       4070     3416     -654     
Flag Coverage Δ
aiguard-integration-active 41.59% <14.28%> (-0.02%) ⬇️
aiguard-integration-latest 41.73% <14.28%> (-0.02%) ⬇️
aiguard-integration-maintenance 41.80% <14.28%> (+0.11%) ⬆️
aiguard-macos 34.56% <14.28%> (-0.09%) ⬇️
aiguard-ubuntu 34.71% <14.28%> (-0.09%) ⬇️
aiguard-windows 34.39% <14.28%> (-0.09%) ⬇️
apm-capabilities-tracing-macos 48.53% <32.14%> (+0.35%) ⬆️
apm-capabilities-tracing-ubuntu-active 48.35% <32.14%> (?)
apm-capabilities-tracing-ubuntu-latest 48.35% <32.14%> (-0.01%) ⬇️
apm-capabilities-tracing-ubuntu-oldest ?
apm-capabilities-tracing-windows 48.16% <32.14%> (+0.16%) ⬆️
apm-integrations-aerospike-18-gte.5.2.0 33.08% <32.14%> (?)
apm-integrations-aerospike-20-gte.5.5.0 33.10% <32.14%> (-0.08%) ⬇️
apm-integrations-aerospike-22-gte.5.12.1 33.11% <32.14%> (-0.08%) ⬇️
apm-integrations-aerospike-22-gte.6.0.0 33.11% <32.14%> (-0.08%) ⬇️
apm-integrations-aerospike-eol- 42.67% <ø> (+9.58%) ⬆️
apm-integrations-child-process 34.01% <14.28%> (-0.09%) ⬇️
apm-integrations-confluentinc-kafka-javascript-18 40.01% <32.14%> (-0.10%) ⬇️
apm-integrations-confluentinc-kafka-javascript-20 40.02% <32.14%> (-0.10%) ⬇️
apm-integrations-confluentinc-kafka-javascript-22 40.03% <32.14%> (-0.10%) ⬇️
apm-integrations-confluentinc-kafka-javascript-24 39.92% <32.14%> (-0.10%) ⬇️
apm-integrations-couchbase-eol 33.15% <32.14%> (-0.08%) ⬇️
apm-integrations-couchbase-oldest 33.10% <32.14%> (?)
apm-integrations-dns 32.95% <32.14%> (-0.08%) ⬇️
apm-integrations-elasticsearch 34.14% <32.14%> (-0.05%) ⬇️
apm-integrations-http-latest 41.93% <32.14%> (+0.01%) ⬆️
apm-integrations-http-maintenance 42.02% <32.14%> (+0.01%) ⬆️
apm-integrations-http-oldest 41.95% <32.14%> (+0.01%) ⬆️
apm-integrations-http2 39.04% <14.28%> (-0.09%) ⬇️
apm-integrations-kafkajs-latest 40.06% <32.14%> (-0.19%) ⬇️
apm-integrations-kafkajs-oldest 40.24% <32.14%> (+<0.01%) ⬆️
apm-integrations-net 33.64% <32.14%> (?)
apm-integrations-next-11.1.4 36.54% <ø> (-0.07%) ⬇️
apm-integrations-next-12.3.7 36.54% <ø> (-0.07%) ⬇️
apm-integrations-next-13.0.0 29.11% <14.28%> (?)
apm-integrations-next-13.2.0 29.11% <14.28%> (-0.06%) ⬇️
apm-integrations-next-13.5.11 29.28% <14.28%> (-0.02%) ⬇️
apm-integrations-next-14.0.0 29.17% <14.28%> (-0.06%) ⬇️
apm-integrations-next-14.2.35 29.17% <14.28%> (-0.06%) ⬇️
apm-integrations-next-14.2.6 29.17% <14.28%> (-0.06%) ⬇️
apm-integrations-next-14.2.7 29.17% <14.28%> (-0.06%) ⬇️
apm-integrations-next-15.0.0 29.17% <14.28%> (-0.06%) ⬇️
apm-integrations-next-15.4.0 29.24% <14.28%> (?)
apm-integrations-next-latest 29.28% <14.28%> (-0.06%) ⬇️
apm-integrations-oracledb 33.97% <32.14%> (-0.06%) ⬇️
apm-integrations-prisma-18-gte.6.16.0.and.lt.7.0.0 ?
apm-integrations-prisma-latest-all 34.22% <32.14%> (-0.09%) ⬇️
apm-integrations-restify 35.61% <32.14%> (+0.34%) ⬆️
apm-integrations-sharedb 32.55% <32.14%> (+0.01%) ⬆️
apm-integrations-tedious 33.89% <32.14%> (+0.44%) ⬆️
appsec-express 51.25% <32.14%> (+0.29%) ⬆️
appsec-fastify 48.04% <32.14%> (+0.28%) ⬆️
appsec-graphql 47.75% <32.14%> (?)
appsec-integration-active 36.10% <14.28%> (+<0.01%) ⬆️
appsec-integration-latest 36.10% <14.28%> (+<0.01%) ⬆️
appsec-integration-maintenance 36.16% <14.28%> (+<0.01%) ⬆️
appsec-integration-oldest 36.15% <14.28%> (+<0.01%) ⬆️
appsec-kafka 40.26% <14.28%> (-0.08%) ⬇️
appsec-ldapjs 39.78% <32.14%> (-0.10%) ⬇️
appsec-lodash 39.70% <14.28%> (-0.10%) ⬇️
appsec-macos 57.11% <32.14%> (+0.06%) ⬆️
appsec-mongodb-core 43.87% <32.14%> (-0.09%) ⬇️
appsec-mongoose 44.72% <32.14%> (-0.09%) ⬇️
appsec-mysql 47.06% <32.14%> (+0.03%) ⬆️
appsec-next-latest-11.1.4 27.40% <14.28%> (-0.05%) ⬇️
appsec-next-latest-12.3.7 27.54% <ø> (+0.12%) ⬆️
appsec-next-latest-13.0.0 29.19% <14.28%> (-0.06%) ⬇️
appsec-next-latest-13.2.0 29.21% <14.28%> (-0.06%) ⬇️
appsec-next-latest-13.5.11 29.30% <14.28%> (-0.06%) ⬇️
appsec-next-latest-14.0.0 ?
appsec-next-latest-14.2.35 29.23% <14.28%> (-0.06%) ⬇️
appsec-next-latest-14.2.6 29.23% <14.28%> (-0.06%) ⬇️
appsec-next-latest-14.2.7 29.23% <14.28%> (-0.06%) ⬇️
appsec-next-latest-15.0.0 29.23% <14.28%> (?)
appsec-next-latest-latest 29.27% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-11.1.4 27.46% <14.28%> (-0.04%) ⬇️
appsec-next-oldest-12.3.7 29.24% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-13.0.0 29.24% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-13.2.0 ?
appsec-next-oldest-13.5.11 29.60% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-14.0.0 29.54% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-14.2.35 29.54% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-14.2.6 29.54% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-14.2.7 29.54% <14.28%> (?)
appsec-next-oldest-15.0.0 29.54% <14.28%> (-0.06%) ⬇️
appsec-next-oldest-latest 27.74% <ø> (+0.12%) ⬆️
appsec-node-serialize 38.99% <32.14%> (-0.12%) ⬇️
appsec-passport 42.62% <32.14%> (-0.10%) ⬇️
appsec-postgres 46.87% <32.14%> (+0.11%) ⬆️
appsec-sourcing 38.47% <14.28%> (-0.08%) ⬇️
appsec-stripe 40.52% <32.14%> (-0.07%) ⬇️
appsec-template 39.28% <32.14%> (-0.10%) ⬇️
appsec-ubuntu 57.22% <32.14%> (+0.06%) ⬆️
appsec-windows ?
debugger-ubuntu-active 43.32% <14.28%> (?)
debugger-ubuntu-latest 43.32% <14.28%> (-0.07%) ⬇️
debugger-ubuntu-maintenance 43.45% <14.28%> (?)
debugger-ubuntu-oldest 43.75% <14.28%> (-0.15%) ⬇️
instrumentations-instrumentation-ai 45.76% <ø> (+0.23%) ⬆️
instrumentations-instrumentation-aws-sdk 45.33% <ø> (+0.22%) ⬆️
instrumentations-instrumentation-bluebird 27.63% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-body-parser 35.64% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-child_process 33.32% <32.14%> (-0.09%) ⬇️
instrumentations-instrumentation-connect 48.74% <ø> (+0.22%) ⬆️
instrumentations-instrumentation-cookie-parser 29.53% <14.28%> (-0.05%) ⬇️
instrumentations-instrumentation-couchbase-18 46.47% <ø> (+0.23%) ⬆️
instrumentations-instrumentation-couchbase-eol 46.47% <ø> (+0.23%) ⬆️
instrumentations-instrumentation-crypto 27.59% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-express 29.73% <14.28%> (-0.05%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 29.64% <14.28%> (-0.05%) ⬇️
instrumentations-instrumentation-express-multi-version 42.09% <ø> (+0.28%) ⬆️
instrumentations-instrumentation-express-session 35.47% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-fastify 48.67% <ø> (+0.20%) ⬆️
instrumentations-instrumentation-fetch 45.50% <ø> (+0.28%) ⬆️
instrumentations-instrumentation-fs 27.31% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-generic-pool 27.50% <0.00%> (+0.04%) ⬆️
instrumentations-instrumentation-hono 28.83% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-http 37.90% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-http-client-options 37.51% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-kafkajs 49.40% <ø> (+0.20%) ⬆️
instrumentations-instrumentation-knex 27.61% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-koa 46.34% <ø> (+0.23%) ⬆️
instrumentations-instrumentation-light-my-request 35.28% <32.14%> (-0.09%) ⬇️
instrumentations-instrumentation-mongoose 28.72% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-multer 35.32% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-mysql2 33.43% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-openai-lifecycle 46.44% <ø> (+0.22%) ⬆️
instrumentations-instrumentation-otel-sdk-trace 25.54% <16.66%> (+0.09%) ⬆️
instrumentations-instrumentation-passport 39.25% <32.14%> (-0.03%) ⬇️
instrumentations-instrumentation-passport-http 38.95% <32.14%> (-0.03%) ⬇️
instrumentations-instrumentation-passport-local 39.39% <32.14%> (-0.03%) ⬇️
instrumentations-instrumentation-pg 33.16% <32.14%> (-0.08%) ⬇️
instrumentations-instrumentation-promise 27.57% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-promise-js 27.57% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-q 27.60% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-restify 47.99% <ø> (+0.23%) ⬆️
instrumentations-instrumentation-router 43.90% <ø> (+0.26%) ⬆️
instrumentations-instrumentation-stripe 28.12% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-url 27.43% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-when 27.59% <14.28%> (-0.06%) ⬇️
instrumentations-instrumentation-zlib 27.47% <14.28%> (-0.06%) ⬇️
instrumentations-integration-esbuild-0.16.12-active 24.71% <14.28%> (-0.01%) ⬇️
instrumentations-integration-esbuild-0.16.12-latest 24.71% <14.28%> (-0.01%) ⬇️
instrumentations-integration-esbuild-0.16.12-maintenance 18.75% <16.66%> (+0.01%) ⬆️
instrumentations-integration-esbuild-0.16.12-oldest 18.74% <16.66%> (+0.01%) ⬆️
instrumentations-integration-esbuild-latest-active ?
instrumentations-integration-esbuild-latest-latest 24.71% <14.28%> (-0.01%) ⬇️
instrumentations-integration-esbuild-latest-maintenance 18.75% <16.66%> (+0.01%) ⬆️
instrumentations-integration-esbuild-latest-oldest 18.74% <16.66%> (+0.01%) ⬆️
llmobs-ai 35.22% <77.77%> (?)
llmobs-anthropic 36.59% <72.22%> (-0.01%) ⬇️
llmobs-bedrock 36.12% <72.22%> (+0.03%) ⬆️
llmobs-google-genai 36.03% <72.22%> (-0.01%) ⬇️
llmobs-langchain 35.57% <77.77%> (+0.04%) ⬆️
llmobs-openai-latest 39.48% <72.22%> (-0.02%) ⬇️
llmobs-openai-oldest 39.56% <72.22%> (-0.02%) ⬇️
llmobs-sdk-active 43.50% <100.00%> (?)
llmobs-sdk-latest 43.50% <100.00%> (+0.06%) ⬆️
llmobs-sdk-maintenance 43.61% <100.00%> (+0.06%) ⬆️
llmobs-sdk-oldest 43.59% <100.00%> (+0.06%) ⬆️
llmobs-vertex-ai 35.70% <72.22%> (+<0.01%) ⬆️
master-coverage 93.27% <100.00%> (?)
openfeature-macos 37.47% <32.14%> (-0.01%) ⬇️
openfeature-ubuntu 37.61% <32.14%> (-0.01%) ⬇️
openfeature-unit-active 50.03% <0.00%> (+0.16%) ⬆️
openfeature-unit-latest 50.03% <0.00%> (+0.16%) ⬆️
openfeature-unit-maintenance 50.39% <0.00%> (+0.15%) ⬆️
openfeature-unit-oldest 50.39% <0.00%> (+0.15%) ⬆️
openfeature-windows 37.36% <32.14%> (?)
platform-core 46.76% <ø> (+0.28%) ⬆️
platform-esbuild 18.69% <16.66%> (-28.80%) ⬇️
platform-instrumentations-misc 29.57% <14.28%> (+0.08%) ⬆️
platform-integration-active 47.23% <32.14%> (+0.20%) ⬆️
platform-integration-latest 47.25% <32.14%> (+0.24%) ⬆️
platform-integration-maintenance 47.01% <32.14%> (?)
platform-integration-oldest 47.26% <32.14%> (-0.07%) ⬇️
platform-shimmer 47.74% <ø> (+0.23%) ⬆️
platform-unit-guardrails 45.60% <ø> (+1.17%) ⬆️
platform-webpack 18.34% <16.66%> (+0.06%) ⬆️
plugins-aws-durable-execution-sdk-js 32.85% <32.14%> (-0.04%) ⬇️
plugins-axios 35.45% <14.28%> (+0.01%) ⬆️
plugins-azure-cosmos 35.78% <32.14%> (-0.23%) ⬇️
plugins-azure-event-hubs 34.82% <14.28%> (+0.01%) ⬆️
plugins-azure-service-bus 35.33% <14.28%> (+0.01%) ⬆️
plugins-body-parser 36.43% <14.28%> (-0.01%) ⬇️
plugins-bullmq 39.40% <32.14%> (-0.10%) ⬇️
plugins-cassandra 33.58% <32.14%> (-0.08%) ⬇️
plugins-cookie 40.97% <ø> (+0.25%) ⬆️
plugins-cookie-parser ?
plugins-crypto 42.99% <ø> (+0.28%) ⬆️
plugins-dd-trace-api 33.17% <14.28%> (-0.10%) ⬇️
plugins-express-mongo-sanitize 40.85% <ø> (+0.25%) ⬆️
plugins-express-session 40.71% <ø> (+0.25%) ⬆️
plugins-fetch 34.51% <14.28%> (-0.07%) ⬇️
plugins-fs 33.59% <14.28%> (-0.09%) ⬇️
plugins-generic-pool 40.28% <ø> (+0.25%) ⬆️
plugins-google-cloud-pubsub 41.29% <32.14%> (-0.09%) ⬇️
plugins-grpc 36.46% <32.14%> (-0.07%) ⬇️
plugins-handlebars 40.85% <ø> (+0.25%) ⬆️
plugins-hapi 35.75% <32.14%> (?)
plugins-hono 35.86% <32.14%> (-0.09%) ⬇️
plugins-ioredis 34.22% <32.14%> (-0.09%) ⬇️
plugins-jest 27.08% <0.00%> (+0.09%) ⬆️
plugins-knex 40.31% <ø> (+0.24%) ⬆️
plugins-langgraph 32.30% <14.28%> (-0.08%) ⬇️
plugins-ldapjs 39.27% <ø> (+0.25%) ⬆️
plugins-light-my-request 40.41% <ø> (+0.24%) ⬆️
plugins-limitd-client 27.93% <14.28%> (?)
plugins-lodash 40.46% <ø> (+0.25%) ⬆️
plugins-mariadb ?
plugins-memcached 33.62% <14.28%> (-0.09%) ⬇️
plugins-microgateway-core 34.70% <32.14%> (-0.18%) ⬇️
plugins-modelcontextprotocol-sdk 32.26% <32.14%> (-0.08%) ⬇️
plugins-moleculer 36.52% <32.14%> (-0.08%) ⬇️
plugins-mongodb 35.82% <32.14%> (+0.02%) ⬆️
plugins-mongodb-core 35.35% <32.14%> (-0.07%) ⬇️
plugins-mongoose 34.50% <32.14%> (+0.10%) ⬆️
plugins-multer 40.77% <ø> (+0.25%) ⬆️
plugins-mysql 34.55% <32.14%> (+0.07%) ⬆️
plugins-mysql2 34.88% <32.14%> (-0.07%) ⬇️
plugins-nats 36.24% <14.28%> (?)
plugins-node-serialize 40.70% <ø> (-0.06%) ⬇️
plugins-opensearch 33.52% <32.14%> (-0.08%) ⬇️
plugins-passport-http 40.58% <ø> (+0.24%) ⬆️
plugins-pino 29.83% <14.28%> (-0.07%) ⬇️
plugins-postgres 34.60% <32.14%> (-0.07%) ⬇️
plugins-process 42.99% <ø> (+0.28%) ⬆️
plugins-pug 40.97% <ø> (+0.25%) ⬆️
plugins-redis 34.26% <32.14%> (-0.03%) ⬇️
plugins-router 37.98% <32.14%> (-0.07%) ⬇️
plugins-sequelize 40.23% <ø> (+0.25%) ⬆️
plugins-test-and-upstream-amqp10 33.76% <32.14%> (?)
plugins-test-and-upstream-amqplib 39.07% <32.14%> (-0.07%) ⬇️
plugins-test-and-upstream-apollo 34.78% <32.14%> (-0.07%) ⬇️
plugins-test-and-upstream-avsc 33.65% <14.28%> (-0.09%) ⬇️
plugins-test-and-upstream-bunyan 29.05% <14.28%> (-0.06%) ⬇️
plugins-test-and-upstream-connect 36.25% <32.14%> (?)
plugins-test-and-upstream-graphql 36.03% <32.14%> (+0.02%) ⬆️
plugins-test-and-upstream-koa 35.80% <32.14%> (-0.09%) ⬇️
plugins-test-and-upstream-protobufjs 33.88% <14.28%> (-0.09%) ⬇️
plugins-test-and-upstream-rhea 39.01% <32.14%> (-0.09%) ⬇️
plugins-undici 34.95% <14.28%> (-0.07%) ⬇️
plugins-url 42.99% <ø> (+0.28%) ⬆️
plugins-valkey 33.72% <32.14%> (-0.09%) ⬇️
plugins-vm 42.99% <ø> (+0.28%) ⬆️
plugins-winston 29.71% <14.28%> (-0.07%) ⬇️
plugins-ws 37.00% <32.14%> (-0.08%) ⬇️
profiling-macos 43.09% <14.28%> (-0.01%) ⬇️
profiling-ubuntu 43.47% <14.28%> (-0.01%) ⬇️
profiling-windows 41.10% <14.28%> (+0.17%) ⬆️
serverless-aws-sdk-latest-aws-sdk ?
serverless-aws-sdk-latest-bedrockruntime 31.94% <32.14%> (?)
serverless-aws-sdk-latest-client 36.57% <ø> (+0.24%) ⬆️
serverless-aws-sdk-latest-dynamodb 33.88% <32.14%> (-0.04%) ⬇️
serverless-aws-sdk-latest-eventbridge 27.11% <14.28%> (-0.05%) ⬇️
serverless-aws-sdk-latest-kinesis 37.11% <32.14%> (?)
serverless-aws-sdk-latest-lambda 34.36% <32.14%> (-0.03%) ⬇️
serverless-aws-sdk-latest-s3 32.32% <32.14%> (?)
serverless-aws-sdk-latest-serverless-peer-service 39.25% <32.14%> (?)
serverless-aws-sdk-latest-sns 38.03% <32.14%> (-0.12%) ⬇️
serverless-aws-sdk-latest-sqs ?
serverless-aws-sdk-latest-stepfunctions 32.96% <32.14%> (?)
serverless-aws-sdk-latest-util 47.14% <ø> (+0.27%) ⬆️
serverless-aws-sdk-oldest-aws-sdk 33.19% <32.14%> (-0.04%) ⬇️
serverless-aws-sdk-oldest-bedrockruntime ?
serverless-aws-sdk-oldest-client 37.15% <ø> (+0.24%) ⬆️
serverless-aws-sdk-oldest-dynamodb ?
serverless-aws-sdk-oldest-eventbridge 27.19% <14.28%> (-0.05%) ⬇️
serverless-aws-sdk-oldest-kinesis 37.28% <32.14%> (?)
serverless-aws-sdk-oldest-lambda 34.46% <32.14%> (-0.03%) ⬇️
serverless-aws-sdk-oldest-s3 32.46% <32.14%> (-0.04%) ⬇️
serverless-aws-sdk-oldest-serverless-peer-service 39.34% <32.14%> (-0.04%) ⬇️
serverless-aws-sdk-oldest-sns 38.13% <32.14%> (?)
serverless-aws-sdk-oldest-sqs 37.88% <32.14%> (+0.03%) ⬆️
serverless-aws-sdk-oldest-stepfunctions 33.06% <32.14%> (-0.02%) ⬇️
serverless-aws-sdk-oldest-util 47.91% <ø> (+0.26%) ⬆️
serverless-azure-durable-functions 36.93% <14.28%> (?)
serverless-azure-functions-eventhubs 38.36% <32.14%> (-0.01%) ⬇️
serverless-azure-functions-servicebus 38.41% <32.14%> (-0.01%) ⬇️
serverless-lambda 34.31% <14.28%> (-0.07%) ⬇️
test-optimization-cucumber-latest-7.0.0 49.90% <14.28%> (+0.22%) ⬆️
test-optimization-cucumber-latest-latest 52.60% <14.28%> (+0.20%) ⬆️
test-optimization-cucumber-oldest-7.0.0 49.98% <14.28%> (+0.22%) ⬆️
test-optimization-cypress-latest-12.0.0-commonJS 47.37% <32.14%> (-1.68%) ⬇️
test-optimization-cypress-latest-12.0.0-esm 48.75% <32.14%> (+1.62%) ⬆️
test-optimization-cypress-latest-14.5.4-commonJS 47.33% <14.28%> (-1.06%) ⬇️
test-optimization-cypress-latest-14.5.4-esm 49.09% <32.14%> (+1.88%) ⬆️
test-optimization-cypress-latest-latest-commonJS 49.05% <32.14%> (-0.34%) ⬇️
test-optimization-cypress-latest-latest-esm 48.26% <32.14%> (-1.15%) ⬇️
test-optimization-cypress-oldest-12.0.0-commonJS 49.30% <32.14%> (+0.16%) ⬆️
test-optimization-cypress-oldest-12.0.0-esm 48.04% <32.14%> (+0.69%) ⬆️
test-optimization-cypress-oldest-14.5.4-commonJS 49.12% <32.14%> (+0.44%) ⬆️
test-optimization-cypress-oldest-14.5.4-esm 49.04% <32.14%> (+0.02%) ⬆️
test-optimization-jest-latest-latest 55.28% <14.28%> (+0.81%) ⬆️
test-optimization-jest-latest-oldest 54.21% <14.28%> (+0.15%) ⬆️
test-optimization-jest-oldest-latest 52.85% <14.28%> (-2.33%) ⬇️
test-optimization-jest-oldest-oldest 51.99% <14.28%> (-2.08%) ⬇️
test-optimization-mocha-latest-latest 53.54% <14.28%> (+0.16%) ⬆️
test-optimization-mocha-latest-oldest 51.17% <14.28%> (+0.21%) ⬆️
test-optimization-mocha-oldest-latest 53.65% <14.28%> (+0.16%) ⬆️
test-optimization-mocha-oldest-oldest ?
test-optimization-playwright-latest-latest-playwright-active-test-span 44.23% <14.28%> (+0.38%) ⬆️
test-optimization-playwright-latest-latest-playwright-atr 43.05% <14.28%> (+0.23%) ⬆️
test-optimization-playwright-latest-latest-playwright-efd 43.46% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-latest-latest-playwright-final-status 43.53% <14.28%> (+0.25%) ⬆️
test-optimization-playwright-latest-latest-playwright-impacted-tests 43.00% <14.28%> (+0.12%) ⬆️
test-optimization-playwright-latest-latest-playwright-reporting ?
test-optimization-playwright-latest-latest-playwright-test-management 44.53% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-latest-oldest-playwright-active-test-span 44.20% <14.28%> (+0.38%) ⬆️
test-optimization-playwright-latest-oldest-playwright-atr ?
test-optimization-playwright-latest-oldest-playwright-efd 43.38% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-latest-oldest-playwright-final-status 43.44% <14.28%> (+0.23%) ⬆️
test-optimization-playwright-latest-oldest-playwright-impacted-tests 42.93% <14.28%> (+0.12%) ⬆️
test-optimization-playwright-latest-oldest-playwright-reporting 42.89% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-latest-oldest-playwright-test-management ?
test-optimization-playwright-oldest-latest-playwright-active-test-span 44.45% <14.28%> (?)
test-optimization-playwright-oldest-latest-playwright-atr 43.12% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-oldest-latest-playwright-efd 43.52% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-oldest-latest-playwright-final-status ?
test-optimization-playwright-oldest-latest-playwright-impacted-tests ?
test-optimization-playwright-oldest-latest-playwright-reporting 43.14% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-oldest-latest-playwright-test-management 44.61% <14.28%> (+0.20%) ⬆️
test-optimization-playwright-oldest-oldest-playwright-active-test-span 44.28% <14.28%> (+0.38%) ⬆️
test-optimization-playwright-oldest-oldest-playwright-atr 43.19% <14.28%> (+0.23%) ⬆️
test-optimization-playwright-oldest-oldest-playwright-efd 43.46% <14.28%> (?)
test-optimization-playwright-oldest-oldest-playwright-final-status 43.53% <14.28%> (+0.23%) ⬆️
test-optimization-playwright-oldest-oldest-playwright-impacted-tests 43.01% <14.28%> (+0.12%) ⬆️
test-optimization-playwright-oldest-oldest-playwright-reporting 42.95% <14.28%> (+0.21%) ⬆️
test-optimization-playwright-oldest-oldest-playwright-test-management 44.57% <14.28%> (+0.22%) ⬆️
test-optimization-selenium-latest ?
test-optimization-testopt-active 48.21% <14.28%> (+0.11%) ⬆️
test-optimization-testopt-latest 48.20% <14.28%> (+0.10%) ⬆️
test-optimization-testopt-maintenance 48.09% <14.28%> (?)
test-optimization-testopt-oldest 49.39% <14.28%> (+0.18%) ⬆️
test-optimization-vitest-latest 49.85% <14.28%> (+0.38%) ⬆️
test-optimization-vitest-oldest 48.17% <14.28%> (+1.09%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@pr-commenter

pr-commenter Bot commented Jun 22, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-26 17:06:40

Comparing candidate commit ff8b677 in PR branch yunkim/llmobs-sampling with baseline commit ccbc9d2 in branch master.

📊 Benchmarking dashboard

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-155.910ms; +144.579ms] or [-5.977%; +5.543%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-171556.304µs; +173047.037µs] or [-6.920%; +6.980%]

scenario:appsec-control-20

  • unstable execution_time [-136.602ms; +102.711ms] or [-8.100%; +6.090%]

scenario:appsec-control-24

  • unstable execution_time [-91035.802µs; +89067.202µs] or [-7.640%; +7.475%]

scenario:appsec-control-26

  • unstable execution_time [-95.425ms; +98.664ms] or [-8.050%; +8.323%]

scenario:debugger-line-probe-with-snapshot-default-20

  • unstable max_rss_usage [-7.544MB; +10.822MB] or [-4.147%; +5.949%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-320.234ms; +457.601ms] or [-6.476%; +9.254%]
  • unstable execution_time [-323.106ms; +459.105ms] or [-6.435%; +9.144%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-24

  • unstable cpu_user_time [-442.666ms; +110.329ms] or [-10.068%; +2.509%]
  • unstable execution_time [-475.826ms; +122.509ms] or [-10.174%; +2.619%]
  • unstable max_rss_usage [-60.978MB; +19.066MB] or [-11.403%; +3.565%]

scenario:plugin-graphql-long-with-depth-off-20

  • unstable max_rss_usage [-4.363MB; +12.048MB] or [-3.220%; +8.891%]

scenario:spans-finish-later-26

  • unstable max_rss_usage [-12.643MB; +18.984MB] or [-7.506%; +11.271%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-3.258MB; +6.819MB] or [-4.093%; +8.567%]

Comment thread packages/dd-trace/src/llmobs/constants/tags.js Outdated
Comment thread packages/dd-trace/src/llmobs/constants/tags.js Outdated
Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
Comment thread packages/dd-trace/src/llmobs/util.js Outdated
Comment thread packages/dd-trace/src/llmobs/span_processor.js Outdated
Comment thread packages/dd-trace/src/llmobs/index.js Outdated
Comment thread packages/dd-trace/src/llmobs/index.js Outdated
Comment thread packages/dd-trace/src/llmobs/index.js
Comment thread packages/dd-trace/src/config/generated-config-types.d.ts
Comment thread packages/dd-trace/src/config/generated-config-types.d.ts
Comment thread packages/dd-trace/src/config/supported-configurations.json
Yun-Kim and others added 4 commits June 24, 2026 13:46
- Match dd-trace-py: only the true trace root makes a fresh sampling
  decision; a span under a propagated LLMObs parent inherits whatever
  was propagated (possibly none) instead of starting a divergent one.
- Reuse the shared formatKnuthRate (hoisted to sampler.js) instead of a
  bespoke llmobs formatRate.
- Rename handleLLMObsParentIdInjection -> handleLLMObsInjection.
- Declare llmobs.sampleRate in the public index.d.ts (fixes config-names
  lint) and tag sample_rate on enablement telemetry.
- Drop redundant comments flagged in review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread packages/dd-trace/src/sampler.js Outdated
Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
Comment thread packages/dd-trace/src/llmobs/index.js Outdated
Comment thread packages/dd-trace/src/llmobs/index.js
Comment thread packages/dd-trace/src/config/generated-config-types.d.ts
Yun-Kim and others added 2 commits June 24, 2026 14:49
- Rebuild the sampler lazily from the live config rate so a disable/
  re-enable (or any rate change) is reflected, instead of caching one
  sampler at construction.
- Tweak the injection comment wording.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep the formatter in priority_sampler.js (export it) instead of
hoisting to sampler.js, per review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread packages/dd-trace/src/llmobs/tagger.js
Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
The sample rate is set at init and not mutable at runtime, so the
per-span lazy rebuild was unnecessary work on a hot path. Build it once
at construction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
Comment thread packages/dd-trace/test/llmobs/tagger.spec.js
@Yun-Kim Yun-Kim marked this pull request as ready for review June 24, 2026 20:11
@Yun-Kim Yun-Kim requested review from a team as code owners June 24, 2026 20:11
@Yun-Kim Yun-Kim requested review from BridgeAR and removed request for a team June 24, 2026 20:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbda2e5b15

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread index.d.ts
Comment thread index.d.ts
Comment thread index.d.ts
Comment thread index.d.ts
Yun-Kim and others added 2 commits June 25, 2026 13:26
…onfig-reactive

- Mirror `llmobs.sampleRate` in the v5 type declarations (index.d.v5.ts), per
  the repo type policy requiring non-v6-only public APIs in both declaration
  surfaces (PR review).
- Register DD_LLMOBS_SAMPLE_RATE as implementation "A" in
  supported-configurations.json (PR review); generated types are unchanged.
- Build the LLMObs sampler lazily and rebuild it when config.llmobs.sampleRate
  changes, instead of fixing it for the tagger's lifetime, so a future remote
  config update to the sample rate takes effect without re-instantiation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…1.0)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@sabrenner sabrenner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

just a couple of comments but lgtm!

Comment thread packages/dd-trace/src/llmobs/tagger.js Outdated
Comment thread index.d.ts Outdated
Comment thread packages/dd-trace/src/priority_sampler.js Outdated
Comment thread packages/dd-trace/test/llmobs/tagger.spec.js Outdated
- Drop the redundant #samplerRate field; use sampler.rate() for the rebuild check.
- Move formatKnuthRate to the shared src/util.js so the LLMObs tagger no longer
  imports priority_sampler just for a string formatter.
- Reword the sampleRate JSDoc in index.d.ts and index.d.v5.ts ("honored at
  ingestion time").
- Test rates that exercise the formatter: 1/3 (6-decimal cap) and 0.25
  (trailing-zero stripping).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Yun-Kim Yun-Kim merged commit 76403e6 into master Jun 26, 2026
805 checks passed
@Yun-Kim Yun-Kim deleted the yunkim/llmobs-sampling branch June 26, 2026 19:26
dd-octo-sts Bot pushed a commit that referenced this pull request Jun 26, 2026
* feat(llmobs): add sampling decisions, rates, and propagation

Compute a keep/drop decision + rate once on the root LLMObs span and
inherit it across spans and services (via x-datadog-tags). Spans are
always shipped; the decision is recorded in the event _dd block so the
backend can honor it. Mirrors dd-trace-py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): address sampling PR review comments

- Match dd-trace-py: only the true trace root makes a fresh sampling
  decision; a span under a propagated LLMObs parent inherits whatever
  was propagated (possibly none) instead of starting a divergent one.
- Reuse the shared formatKnuthRate (hoisted to sampler.js) instead of a
  bespoke llmobs formatRate.
- Rename handleLLMObsParentIdInjection -> handleLLMObsInjection.
- Declare llmobs.sampleRate in the public index.d.ts (fixes config-names
  lint) and tag sample_rate on enablement telemetry.
- Drop redundant comments flagged in review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(llmobs): regenerate config types after merging master

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): address follow-up sampling review comments

- Rebuild the sampler lazily from the live config rate so a disable/
  re-enable (or any rate change) is reflected, instead of caching one
  sampler at construction.
- Tweak the injection comment wording.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): export formatKnuthRate from priority_sampler.js

Keep the formatter in priority_sampler.js (export it) instead of
hoisting to sampler.js, per review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): build the sampler once in the tagger constructor

The sample rate is set at init and not mutable at runtime, so the
per-span lazy rebuild was unnecessary work on a hot path. Build it once
at construction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update packages/dd-trace/src/llmobs/tagger.js

* refactor(llmobs): address sampling review comments and make sampler config-reactive

- Mirror `llmobs.sampleRate` in the v5 type declarations (index.d.v5.ts), per
  the repo type policy requiring non-v6-only public APIs in both declaration
  surfaces (PR review).
- Register DD_LLMOBS_SAMPLE_RATE as implementation "A" in
  supported-configurations.json (PR review); generated types are unchanged.
- Build the LLMObs sampler lazily and rebuild it when config.llmobs.sampleRate
  changes, instead of fixing it for the tagger's lifetime, so a future remote
  config update to the sample rate takes effect without re-instantiation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(llmobs): match DD_LLMOBS_SAMPLE_RATE default to config registry (1.0)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): address remaining sampling review comments

- Drop the redundant #samplerRate field; use sampler.rate() for the rebuild check.
- Move formatKnuthRate to the shared src/util.js so the LLMObs tagger no longer
  imports priority_sampler just for a string formatter.
- Reword the sampleRate JSDoc in index.d.ts and index.d.v5.ts ("honored at
  ingestion time").
- Test rates that exercise the formatter: 1/3 (6-decimal cap) and 0.25
  (trailing-zero stripping).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jun 26, 2026
pabloerhard pushed a commit that referenced this pull request Jun 26, 2026
* feat(llmobs): add sampling decisions, rates, and propagation

Compute a keep/drop decision + rate once on the root LLMObs span and
inherit it across spans and services (via x-datadog-tags). Spans are
always shipped; the decision is recorded in the event _dd block so the
backend can honor it. Mirrors dd-trace-py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): address sampling PR review comments

- Match dd-trace-py: only the true trace root makes a fresh sampling
  decision; a span under a propagated LLMObs parent inherits whatever
  was propagated (possibly none) instead of starting a divergent one.
- Reuse the shared formatKnuthRate (hoisted to sampler.js) instead of a
  bespoke llmobs formatRate.
- Rename handleLLMObsParentIdInjection -> handleLLMObsInjection.
- Declare llmobs.sampleRate in the public index.d.ts (fixes config-names
  lint) and tag sample_rate on enablement telemetry.
- Drop redundant comments flagged in review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(llmobs): regenerate config types after merging master

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): address follow-up sampling review comments

- Rebuild the sampler lazily from the live config rate so a disable/
  re-enable (or any rate change) is reflected, instead of caching one
  sampler at construction.
- Tweak the injection comment wording.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): export formatKnuthRate from priority_sampler.js

Keep the formatter in priority_sampler.js (export it) instead of
hoisting to sampler.js, per review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): build the sampler once in the tagger constructor

The sample rate is set at init and not mutable at runtime, so the
per-span lazy rebuild was unnecessary work on a hot path. Build it once
at construction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update packages/dd-trace/src/llmobs/tagger.js

* refactor(llmobs): address sampling review comments and make sampler config-reactive

- Mirror `llmobs.sampleRate` in the v5 type declarations (index.d.v5.ts), per
  the repo type policy requiring non-v6-only public APIs in both declaration
  surfaces (PR review).
- Register DD_LLMOBS_SAMPLE_RATE as implementation "A" in
  supported-configurations.json (PR review); generated types are unchanged.
- Build the LLMObs sampler lazily and rebuild it when config.llmobs.sampleRate
  changes, instead of fixing it for the tagger's lifetime, so a future remote
  config update to the sample rate takes effect without re-instantiation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(llmobs): match DD_LLMOBS_SAMPLE_RATE default to config registry (1.0)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(llmobs): address remaining sampling review comments

- Drop the redundant #samplerRate field; use sampler.rate() for the rebuild check.
- Move formatKnuthRate to the shared src/util.js so the LLMObs tagger no longer
  imports priority_sampler just for a string formatter.
- Reword the sampleRate JSDoc in index.d.ts and index.d.v5.ts ("honored at
  ingestion time").
- Test rates that exercise the formatter: 1/3 (6-decimal cap) and 0.25
  (trailing-zero stripping).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pabloerhard pushed a commit that referenced this pull request Jun 26, 2026
The sampling tests in #9030 build their own taggers with `{ llmobs:
{ enabled: true } }`, and #8943 renamed that config key to
`DD_LLMOBS_ENABLED` everywhere it could see. The two landed in parallel,
so #8943 normalized the rest of the file but never saw these four
fixtures. On master the tagger now reads `DD_LLMOBS_ENABLED`, finds it
undefined, and returns before registering the span; `Tagger.tagMap.get`
then yields undefined and the "DROPPED at sampleRate 0" test throws
synchronously, aborting the whole `test:llmobs:sdk:ci` run with exit 7.

Fixes: https://github.com/DataDog/dd-trace-js/actions/runs/28265509637/job/83751636644
dd-octo-sts Bot pushed a commit that referenced this pull request Jun 29, 2026
The sampling tests in #9030 build their own taggers with `{ llmobs:
{ enabled: true } }`, and #8943 renamed that config key to
`DD_LLMOBS_ENABLED` everywhere it could see. The two landed in parallel,
so #8943 normalized the rest of the file but never saw these four
fixtures. On master the tagger now reads `DD_LLMOBS_ENABLED`, finds it
undefined, and returns before registering the span; `Tagger.tagMap.get`
then yields undefined and the "DROPPED at sampleRate 0" test throws
synchronously, aborting the whole `test:llmobs:sdk:ci` run with exit 7.

Fixes: https://github.com/DataDog/dd-trace-js/actions/runs/28265509637/job/83751636644
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