Skip to content

refactor(llmobs): centralize session_id injection in handleLLMObsInjection#9353

Merged
ncybul merged 2 commits into
masterfrom
nicole-cybul/llmobs-centralize-session-injection
Jul 15, 2026
Merged

refactor(llmobs): centralize session_id injection in handleLLMObsInjection#9353
ncybul merged 2 commits into
masterfrom
nicole-cybul/llmobs-centralize-session-injection

Conversation

@ncybul

@ncybul ncybul commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Centralizes session_id cross-service injection into handleLLMObsInjection, so all four propagated LLMObs values (parent_id, ml_app, session_id, sampling) are emitted in one place.

Motivation

Follow-up to the session-propagation work (#9279). Session was handled on a different path from the other propagated values: it was stored on _trace.tags under the _dd.p.llmobs_sid key and injected implicitly by the standard propagator's _injectTags, while parent_id/ml_app are injected explicitly in handleLLMObsInjection.

It was also a subtle correctness gap: _injectTags only runs when the datadog inject propagation style is enabled, whereas handleLLMObsInjection runs regardless. So with a non-datadog inject style, session would silently stop propagating while parent_id/ml_app still did.

Changes

  • In-process trace default moves to an internal, non-_dd.p. key _ml_obs.trace_session_id (constant SESSION_ID_TRACE_DEFAULT_KEY). It is used only for in-process sibling inheritance, so the standard propagator no longer auto-injects it.
  • handleLLMObsInjection now emits _dd.p.llmobs_sid alongside parent_id/ml_app, reading the active span's session (mlObsSpanTags[SESSION_ID]) with fallbacks to the trace default and the extracted _dd.p.llmobs_sid.
  • registerLLMObsSpan resolves a new span's session as explicit → parent → in-process trace default → cross-service propagated.
  • _setTag seeds the internal trace-default key (first-writer-wins).

Testing

  • tagger.spec.js: trace-default establishment/inheritance/override updated to the internal key; added a case for inheriting an upstream-propagated session.
  • index.spec.js: added injection cases for session from the active span and from the trace-level default.
  • packages/dd-trace/test/llmobs/{tagger,index,sdk/index}.spec.js all pass (133 + 100).

Claude session: 3b93fe65-18d2-413f-b53e-2d95f370e1ed
Resume: claude --resume 3b93fe65-18d2-413f-b53e-2d95f370e1ed

🤖 Generated with Claude Code

@ncybul
ncybul requested a review from a team as a code owner July 14, 2026 21:00
@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.77 MB
Deduped: 7.43 MB
No deduping: 7.43 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 438.86 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

…ction

Session_id was propagated via a separate path from the other LLMObs propagated
values (parent_id, ml_app): it was stored on _trace.tags as a `_dd.p.*` tag and
injected implicitly by the standard propagator, while the others are injected
explicitly in handleLLMObsInjection. Per review feedback, handle all of them in
one place.

The in-process trace-level default now lives under an internal, non-`_dd.p.` key
(_ml_obs.trace_session_id) for sibling inheritance only, and handleLLMObsInjection
emits `_dd.p.llmobs_sid` alongside parent_id/ml_app. Session is now handled the
same way as ml_app rather than as a standard-propagator special case.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ncybul
ncybul force-pushed the nicole-cybul/llmobs-centralize-session-injection branch from e1dc73a to 3ed7f1c Compare July 14, 2026 21:03
@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.61% (+0.01%)

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

@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-15 14:35:35

Comparing candidate commit 87b59eb in PR branch nicole-cybul/llmobs-centralize-session-injection with baseline commit 1abef82 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2322 metrics, 36 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 [-209.690ms; +214.831ms] or [-7.908%; +8.102%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-237.845ms; +234.699ms] or [-9.285%; +9.162%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-159.857ms; +156.603ms] or [-5.188%; +5.083%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-189.186ms; +201.169ms] or [-6.502%; +6.914%]

scenario:appsec-control-20

  • unstable execution_time [-107.363ms; +127.403ms] or [-6.520%; +7.737%]

scenario:appsec-control-24

  • unstable execution_time [-120.328ms; +124.355ms] or [-9.714%; +10.039%]

scenario:appsec-control-26

  • unstable execution_time [-124.641ms; +121.529ms] or [-10.058%; +9.807%]

scenario:appsec-iast-no-vulnerability-control-20

  • unstable execution_time [-15865.672µs; +15295.472µs] or [-6.222%; +5.999%]

scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-11.092ms; +25.205ms] or [-4.308%; +9.790%]

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-12.027ms; +14.895ms] or [-4.700%; +5.820%]

scenario:appsec-iast-with-vulnerability-control-20

  • unstable execution_time [-26.567ms; +33.849ms] or [-4.875%; +6.211%]

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

  • unstable cpu_user_time [-4413.728ms; +4419.055ms] or [-37.153%; +37.198%]
  • unstable execution_time [-4396.634ms; +4390.573ms] or [-34.706%; +34.658%]
  • unstable instructions [-39499.2M instructions; +39565.4M instructions] or [-39.422%; +39.488%]
  • unstable max_rss_usage [-15508.219KB; +14178.619KB] or [-9.316%; +8.517%]
  • unstable throughput [-868.850op/s; +832.216op/s] or [-31.489%; +30.161%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-2239.948ms; +740.878ms] or [-23.499%; +7.772%]
  • unstable execution_time [-2263.858ms; +754.288ms] or [-22.068%; +7.353%]
  • unstable instructions [-20.2G instructions; +6.7G instructions] or [-25.351%; +8.392%]
  • unstable throughput [-153.600op/s; +447.141op/s] or [-4.757%; +13.847%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-3620.956ms; +3634.885ms] or [-35.099%; +35.234%]
  • unstable execution_time [-3616.468ms; +3622.982ms] or [-32.694%; +32.753%]
  • unstable instructions [-32245.9M instructions; +32252.8M instructions] or [-37.294%; +37.302%]
  • unstable max_rss_usage [-11291.070KB; +10549.470KB] or [-6.937%; +6.481%]
  • unstable throughput [-707.853op/s; +711.171op/s] or [-23.087%; +23.196%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-473.204ms; +242.911ms] or [-9.646%; +4.952%]
  • unstable execution_time [-470.322ms; +247.468ms] or [-9.439%; +4.967%]
  • unstable throughput [-87059.139op/s; +169336.724op/s] or [-5.167%; +10.050%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-20

  • unstable cpu_user_time [-3691.800µs; +3115.906µs] or [-5.586%; +4.714%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-24

  • unstable cpu_usage_percentage [-4.834%; +6.439%]

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

  • unstable max_rss_usage [-18.333MB; +33.101MB] or [-4.858%; +8.772%]

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

  • unstable max_rss_usage [-5.189MB; +8.130MB] or [-4.107%; +6.436%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-707.194ms; +704.337ms] or [-5.509%; +5.487%]
  • unstable execution_time [-703.868ms; +713.384ms] or [-5.366%; +5.439%]
  • unstable throughput [-3.271op/s; +3.220op/s] or [-5.331%; +5.248%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-3084.485KB; +4826.151KB] or [-3.942%; +6.168%]

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.65%. Comparing base (1abef82) to head (87b59eb).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #9353    +/-   ##
========================================
  Coverage   96.64%   96.65%            
========================================
  Files         923      923            
  Lines      122844   122959   +115     
  Branches    20989    21055    +66     
========================================
+ Hits       118723   118843   +120     
+ Misses       4121     4116     -5     
Flag Coverage Δ
aiguard 53.64% <16.66%> (-0.06%) ⬇️
aiguard-integration 57.10% <16.66%> (-0.01%) ⬇️
apm-bucket-0 53.87% <16.66%> (-0.06%) ⬇️
apm-bucket-1 58.44% <16.66%> (-0.06%) ⬇️
apm-bucket-2 56.17% <16.66%> (-0.06%) ⬇️
apm-capabilities-tracing 60.63% <16.66%> (+<0.01%) ⬆️
apm-integrations-aerospike 53.02% <16.66%> (-0.06%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.17% <16.66%> (-0.06%) ⬇️
apm-integrations-couchbase 53.36% <16.66%> (-0.06%) ⬇️
apm-integrations-http 58.03% <16.66%> (-0.06%) ⬇️
apm-integrations-kafkajs 57.82% <16.66%> (-0.06%) ⬇️
apm-integrations-next 54.25% <16.66%> (-0.06%) ⬇️
apm-integrations-prisma 54.25% <16.66%> (-0.06%) ⬇️
apm-integrations-tedious 53.13% <16.66%> (-0.06%) ⬇️
appsec 68.87% <16.66%> (-0.04%) ⬇️
appsec-express_fastify_graphql 65.73% <16.66%> (-0.04%) ⬇️
appsec-integration 51.93% <16.66%> (-0.02%) ⬇️
appsec-kafka_ldapjs_lodash 59.16% <16.66%> (-0.05%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.39% <16.66%> (-0.05%) ⬇️
appsec-next 52.85% <16.66%> (-0.08%) ⬇️
appsec-node-serialize_passport_postgres 62.03% <16.66%> (-0.05%) ⬇️
appsec-sourcing_stripe_template 60.42% <16.66%> (-0.05%) ⬇️
debugger 65.69% <16.66%> (-0.03%) ⬇️
instrumentations-bucket-0 48.87% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-1 55.08% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-10 56.70% <16.66%> (-0.05%) ⬇️
instrumentations-bucket-11 48.87% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-12 49.04% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-13 48.80% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-2 50.01% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-3 53.98% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-4 49.28% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-5 53.13% <16.66%> (-0.07%) ⬇️
instrumentations-bucket-6 55.72% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-7 53.62% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-8 54.75% <16.66%> (-0.06%) ⬇️
instrumentations-bucket-9 56.18% <16.66%> (-0.05%) ⬇️
instrumentations-instrumentation-couchbase 48.27% <16.66%> (-0.06%) ⬇️
instrumentations-integration-esbuild 34.05% <ø> (-0.02%) ⬇️
llmobs-ai_anthropic_bedrock 57.77% <63.63%> (-0.05%) ⬇️
llmobs-bucket-1 57.10% <72.72%> (-0.05%) ⬇️
llmobs-openai 57.50% <63.63%> (-0.05%) ⬇️
llmobs-sdk 60.07% <100.00%> (-0.04%) ⬇️
llmobs-vertex-ai 54.31% <63.63%> (-0.05%) ⬇️
master-coverage 96.65% <100.00%> (?)
openfeature 54.69% <16.66%> (-0.02%) ⬇️
openfeature-unit 49.90% <16.66%> (-0.06%) ⬇️
platform-core_esbuild_instrumentations-misc 38.52% <16.66%> (-0.05%) ⬇️
platform-integration 62.32% <16.66%> (-0.01%) ⬇️
platform-shimmer_unit-guardrails_webpack 37.32% <16.66%> (-0.05%) ⬇️
plugins-bucket-0 53.25% <16.66%> (-0.05%) ⬇️
plugins-bucket-1 55.19% <16.66%> (-0.01%) ⬇️
plugins-bucket-11 57.52% <16.66%> (-0.05%) ⬇️
plugins-bucket-18 57.14% <16.66%> (-0.05%) ⬇️
plugins-bucket-19 55.43% <16.66%> (-0.06%) ⬇️
plugins-bucket-20 57.65% <16.66%> (-0.06%) ⬇️
plugins-bucket-4 53.87% <16.66%> (-0.06%) ⬇️
plugins-bullmq_cassandra_cookie 57.46% <16.66%> (-0.06%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.41% <16.66%> (-0.06%) ⬇️
plugins-fetch_fs_generic-pool 54.58% <16.66%> (-0.14%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.91% <16.66%> (-0.06%) ⬇️
plugins-hapi_hono_ioredis 55.85% <16.66%> (-0.06%) ⬇️
plugins-jest_knex_langgraph 51.78% <16.66%> (-0.04%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.53% <16.66%> (-0.06%) ⬇️
plugins-lodash_mariadb_memcached 54.29% <16.66%> (-0.06%) ⬇️
plugins-moleculer_mongodb_mongodb-core 57.39% <16.66%> (-0.06%) ⬇️
plugins-mongoose_multer_mysql 54.78% <16.66%> (-0.06%) ⬇️
plugins-mysql2_nats_node-serialize 56.32% <16.66%> (-0.06%) ⬇️
plugins-opensearch_passport-http_pino 55.18% <16.66%> (-0.06%) ⬇️
plugins-postgres_process_pug 54.37% <16.66%> (-0.06%) ⬇️
plugins-redis_router_sequelize 57.18% <16.66%> (-0.05%) ⬇️
plugins-test-and-upstream-rhea_undici_url 57.03% <16.66%> (-0.06%) ⬇️
plugins-valkey_vm_winston 54.01% <16.66%> (-0.06%) ⬇️
plugins-ws 54.92% <16.66%> (-0.05%) ⬇️
profiling 58.25% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-aws-sdk 50.75% <16.66%> (-0.07%) ⬇️
serverless-aws-sdk-bedrockruntime 50.74% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-client 52.08% <16.66%> (-0.06%) ⬇️
serverless-aws-sdk-dynamodb 51.80% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-eventbridge 46.44% <16.66%> (-0.07%) ⬇️
serverless-aws-sdk-kinesis 54.78% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-lambda 52.86% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-s3 51.58% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.81% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-sns 55.53% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-sqs 55.95% <16.66%> (-0.16%) ⬇️
serverless-aws-sdk-stepfunctions 51.35% <16.66%> (-0.05%) ⬇️
serverless-aws-sdk-util 48.53% <16.66%> (-0.06%) ⬇️
serverless-bucket-0 55.23% <16.66%> (-0.01%) ⬇️
serverless-bucket-1 56.05% <16.66%> (-0.06%) ⬇️
test-optimization-cucumber 72.99% <16.66%> (+0.07%) ⬆️
test-optimization-cypress 66.37% <16.66%> (+0.08%) ⬆️
test-optimization-jest 74.36% <16.66%> (+0.03%) ⬆️
test-optimization-mocha 74.73% <16.66%> (+0.09%) ⬆️
test-optimization-playwright-playwright-atr 61.44% <16.66%> (-0.07%) ⬇️
test-optimization-playwright-playwright-efd 61.64% <16.66%> (-0.05%) ⬇️
test-optimization-playwright-playwright-final-status 61.61% <16.66%> (-0.07%) ⬇️
test-optimization-playwright-playwright-impacted-tests 61.33% <16.66%> (+0.10%) ⬆️
test-optimization-playwright-playwright-reporting 61.21% <16.66%> (-0.07%) ⬇️
test-optimization-playwright-playwright-test-management 62.17% <16.66%> (-0.18%) ⬇️
test-optimization-playwright-playwright-test-span 61.36% <16.66%> (-0.12%) ⬇️
test-optimization-selenium 60.74% <16.66%> (-0.08%) ⬇️
test-optimization-testopt 59.23% <16.66%> (+0.15%) ⬆️
test-optimization-vitest 71.30% <16.66%> (-0.08%) ⬇️

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.

Comment thread packages/dd-trace/src/llmobs/index.js Outdated
Yun-Kim
Yun-Kim previously approved these changes Jul 14, 2026

@Yun-Kim Yun-Kim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

small docstring suggestion but lgtm otherwise

@ncybul
ncybul merged commit c0d2787 into master Jul 15, 2026
657 checks passed
@ncybul
ncybul deleted the nicole-cybul/llmobs-centralize-session-injection branch July 15, 2026 20:26
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 16, 2026
…ction (#9353)

* refactor(llmobs): centralize session_id injection in handleLLMObsInjection

Session_id was propagated via a separate path from the other LLMObs propagated
values (parent_id, ml_app): it was stored on _trace.tags as a `_dd.p.*` tag and
injected implicitly by the standard propagator, while the others are injected
explicitly in handleLLMObsInjection. Per review feedback, handle all of them in
one place.

The in-process trace-level default now lives under an internal, non-`_dd.p.` key
(_ml_obs.trace_session_id) for sibling inheritance only, and handleLLMObsInjection
emits `_dd.p.llmobs_sid` alongside parent_id/ml_app. Session is now handled the
same way as ml_app rather than as a standard-propagator special case.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(llmobs): mention session id in handleLLMObsInjection docstring

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 16, 2026
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 16, 2026
…ction (#9353)

* refactor(llmobs): centralize session_id injection in handleLLMObsInjection

Session_id was propagated via a separate path from the other LLMObs propagated
values (parent_id, ml_app): it was stored on _trace.tags as a `_dd.p.*` tag and
injected implicitly by the standard propagator, while the others are injected
explicitly in handleLLMObsInjection. Per review feedback, handle all of them in
one place.

The in-process trace-level default now lives under an internal, non-`_dd.p.` key
(_ml_obs.trace_session_id) for sibling inheritance only, and handleLLMObsInjection
emits `_dd.p.llmobs_sid` alongside parent_id/ml_app. Session is now handled the
same way as ml_app rather than as a standard-propagator special case.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(llmobs): mention session id in handleLLMObsInjection docstring

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 16, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
…ction (#9353)

* refactor(llmobs): centralize session_id injection in handleLLMObsInjection

Session_id was propagated via a separate path from the other LLMObs propagated
values (parent_id, ml_app): it was stored on _trace.tags as a `_dd.p.*` tag and
injected implicitly by the standard propagator, while the others are injected
explicitly in handleLLMObsInjection. Per review feedback, handle all of them in
one place.

The in-process trace-level default now lives under an internal, non-`_dd.p.` key
(_ml_obs.trace_session_id) for sibling inheritance only, and handleLLMObsInjection
emits `_dd.p.llmobs_sid` alongside parent_id/ml_app. Session is now handled the
same way as ml_app rather than as a standard-propagator special case.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(llmobs): mention session id in handleLLMObsInjection docstring

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
…ction (#9353)

* refactor(llmobs): centralize session_id injection in handleLLMObsInjection

Session_id was propagated via a separate path from the other LLMObs propagated
values (parent_id, ml_app): it was stored on _trace.tags as a `_dd.p.*` tag and
injected implicitly by the standard propagator, while the others are injected
explicitly in handleLLMObsInjection. Per review feedback, handle all of them in
one place.

The in-process trace-level default now lives under an internal, non-`_dd.p.` key
(_ml_obs.trace_session_id) for sibling inheritance only, and handleLLMObsInjection
emits `_dd.p.llmobs_sid` alongside parent_id/ml_app. Session is now handled the
same way as ml_app rather than as a standard-propagator special case.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(llmobs): mention session id in handleLLMObsInjection docstring

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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