instrumentation telemetry: validate session id headers#6510
instrumentation telemetry: validate session id headers#6510
Conversation
|
As per https://dd.slack.com/archives/D032MDTSCR1/p1773765779731369 We need to assert:
|
Co-authored-by: Munir Abdinur <munir.abdinur@datadoghq.com>
|
Remaining gaps I believe are: Gap 1: The test should assert that for every event where DD-Session-ID != root_session_id (i.e. every child event), DD-Root-Session-ID must be present not just that at least one event has it globally. Gap 2 (exec vs fork): Same validation function for both test cases, exec propagation via env vars isn't distinctly tested. |
Both cases should be covered by the current test. We can discuss it in our next sync |
|
|
khanayan123
left a comment
There was a problem hiding this comment.
Thanks for addressing the comments, tests LGTM
|
✨ Fix all issues with BitsAI or with Cursor
|
Add a standalone child binary that initializes dd-trace-go and emits telemetry, replacing the previous shell-based approach. Simplify spawn_child.go to use plain os/exec since the SDK now auto-propagates DD_ROOT_GO_SESSION_ID. Update Dockerfile to build/copy the child binary. Mark fork test as irrelevant for Go (no fork support). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of a separate child binary, re-exec the weblog itself with DD_SYSTEM_TEST_CHILD_SLEEP env var. RunAsChildIfRequested() in common handles child mode — starts tracer, sleeps, stops, exits. This avoids a separate build target and Dockerfile changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Match the SDK rename — underscore prefix signifies internal env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ifest - SpawnChildEndpoint now re-execs the dotnet weblog (with CLR profiler) instead of spawning a bare shell for the exec path - Returns 400 for fork=true since .NET doesn't support fork - Manifest: fork test marked irrelevant, spawn test enabled for >=v3.4.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
## Summary Implements the [Stable Service Instance Identifier RFC](https://docs.google.com/document/d/1ECKj9_NnwaKYtFqm3p3Rlpicx5d-OQcdj9kI2jvRqVU) for Go instrumentation telemetry. - **`DD-Session-ID`**: always present on every telemetry request, set to the current `runtime_id` - **`DD-Root-Session-ID`**: present only in child processes, inherited via `_DD_ROOT_GO_SESSION_ID` env var. Omitted when equal to session ID — backend infers root = self when absent - **Auto-propagation**: `globalconfig.init()` sets `_DD_ROOT_GO_SESSION_ID` in `os.Environ()` so child processes spawned via `os/exec` inherit it automatically without any user-side calls ## Changes - `internal/globalconfig/globalconfig.go`: adds `rootSessionID` field, `init()` reads/sets `_DD_ROOT_GO_SESSION_ID` (internal env var, not in supported_configurations), `RootSessionID()` getter - `internal/telemetry/internal/writer.go`: adds `DD-Session-ID` (always) and `DD-Root-Session-ID` (child processes only) to pre-baked telemetry headers - Tests for both globalconfig (including cross-process propagation) and writer ## Related - System-tests PR: DataDog/system-tests#6510 - Node.js PR: DataDog/dd-trace-js#7821 - dd-trace-py fork tracking: DataDog/dd-trace-py#16839 - dd-trace-py spawn tracking: DataDog/dd-trace-py#16842 Co-authored-by: ayan.khan <ayan.khan@datadoghq.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation
Enable telemetry session ID header tests (
DD-Session-ID,DD-Root-Session-ID,DD-Parent-Session-ID) across process forks per the Stable Service Instance Identifier RFC.Changes
sleep,crash,fork. Uses fork when supported, exec otherwise. Runtimes without fork (Java, Go, PHP, .NET) return 400 forfork=true.test_session_id_headers_across_forksandtest_session_id_headers_across_spawnedvalidate session ID headers in lifecycle telemetry. Usesget_lifecycle_events()to avoid lib-datadog metrics/log events. Asserts: DD-Session-ID = runtime_id, one root per app instance, at least two runtimes (parent + child).get_lifecycle_events()added to filter lifecycle events.docs/weblog/end-to-end_weblog.md.missing_featurefor other weblogs and non-fork runtimes.Workflow
🚀 Once your PR is reviewed and the CI is green, you can merge it!
🛟 #apm-shared-testing 🛟
SDK Implementations
Nodejs: DataDog/dd-trace-js#7821
Go: DataDog/dd-trace-go#4574
Java: DataDog/dd-trace-java#10914