Skip to content

Implement stable session identifier headers for telemetry#295

Open
khanayan123 wants to merge 6 commits intomainfrom
ayan.khan/stable-session-id-headers
Open

Implement stable session identifier headers for telemetry#295
khanayan123 wants to merge 6 commits intomainfrom
ayan.khan/stable-session-id-headers

Conversation

@khanayan123
Copy link

@khanayan123 khanayan123 commented Mar 20, 2026

Summary

Implements the Stable Service Instance Identifier RFC for the C++ SDK.

  • Adds DD-Session-ID (= runtime_id) and conditional DD-Root-Session-ID headers to all telemetry requests (app-started, heartbeats, app-closing, etc.)
  • DD-Root-Session-ID is only sent when it differs from DD-Session-ID (i.e., in child processes)
  • Root session ID is read from _DD_ROOT_CPP_SESSION_ID via the config registry (environment::lookup) or defaults to the current runtime_id
  • environment::set(_DD_ROOT_CPP_SESSION_ID, ...) is called at tracer init so exec'd children inherit it automatically (no-op if already set)
  • Fork propagation is automatic — memory survives fork, so the root session ID persists in child processes

Integration testing note

System-tests for cpp_nginx and cpp_httpd cannot validate session headers until the downstream modules (nginx-datadog, httpd-datadog) release a version that includes these dd-trace-cpp changes. The system-tests manifest entries remain missing_feature until then. Unit tests in this PR should validate the implementation directly.

Companion system-tests PR: DataDog/system-tests#6510

@pr-commenter
Copy link

pr-commenter bot commented Mar 20, 2026

Benchmarks

Benchmark execution time: 2026-03-26 19:14:04

Comparing candidate commit f124ca3 in PR branch ayan.khan/stable-session-id-headers with baseline commit 910e3d5 in branch main.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 0 metrics, 0 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 ----------------------------------'

scenario:BM_TraceTinyCCSource

  • 🟥 execution_time [+3.745ms; +3.941ms] or [+4.997%; +5.259%]

@datadog-prod-us1-6
Copy link

datadog-prod-us1-6 bot commented Mar 23, 2026

🎯 Code Coverage (details)
Patch Coverage: 83.87%
Overall Coverage: 90.83% (-0.00%)

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

Adds DD-Session-ID and DD-Root-Session-ID HTTP headers to all telemetry
requests per the Stable Service Instance Identifier RFC.

- DD-Session-ID is always set to the tracer's runtime_id
- DD-Root-Session-ID is only set when it differs from the session ID
  (i.e. when running as a child process)
- Root session ID is propagated to exec'd children via
  _DD_ROOT_CPP_SESSION_ID env var, read in finalize_config()
- _DD_ROOT_CPP_SESSION_ID registered in the environment variable
  registry and supported-configurations.json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@khanayan123 khanayan123 force-pushed the ayan.khan/stable-session-id-headers branch from 85d241a to e40dd5d Compare March 25, 2026 14:35
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The central registry has this config as implementation B with an empty
string default. Update environment.h to use "" and teach config-inversion
to emit "B" for this var via an override map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Registry entry had trailing space in name (now fixed by registry team).
Use implementation A and null default to match registry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants