Skip to content

Use a webserver-wide session id instead of per fork#3828

Open
bwoebi wants to merge 1 commit intomasterfrom
bob/gloabl-session
Open

Use a webserver-wide session id instead of per fork#3828
bwoebi wants to merge 1 commit intomasterfrom
bob/gloabl-session

Conversation

@bwoebi
Copy link
Copy Markdown
Collaborator

@bwoebi bwoebi commented Apr 24, 2026

This is what session_id supposedly is actually meant to mean.

@bwoebi bwoebi requested review from a team as code owners April 24, 2026 15:59
Copy link
Copy Markdown

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

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: 4b10ad2605

ℹ️ 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 ext/ddtrace.c
Comment on lines +435 to +436
if (dd_main_pid != getpid()) { // equal to session id if not a fork
ddtrace_generate_runtime_id();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Generate runtime ID in non-forked processes

This guard skips ddtrace_generate_runtime_id() when the process that ran MINIT also runs RINIT (e.g., CLI, single-process SAPIs, and Windows). In that case ddtrace_runtime_id stays at its zero-initialized value, so emitted runtime-id values become 00000000-0000-0000-0000-000000000000 instead of a unique UUID, which breaks per-runtime correlation in traces/telemetry.

Useful? React with 👍 / 👎.

Comment thread ext/sidecar.c
ddtrace_sidecar_push_tag(tags, DDOG_CHARSLICE_C("language"), DDOG_CHARSLICE_C("php"));
ddtrace_sidecar_push_tag(tags, DDOG_CHARSLICE_C("runtime"), DDOG_CHARSLICE_C("php"));
ddtrace_sidecar_push_tag(tags, DDOG_CHARSLICE_C("runtime-id"), (ddog_CharSlice) {.ptr = (char *) dd_sidecar_formatted_session_id, .len = sizeof(dd_sidecar_formatted_session_id)});
ddtrace_sidecar_push_tag(tags, DDOG_CHARSLICE_C("runtime-id"), (ddog_CharSlice) {.ptr = (char *) ddtrace_formatted_session_id, .len = sizeof(ddtrace_formatted_session_id)});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep crash metadata runtime-id tied to runtime UUID

The runtime-id crash tag is now populated from ddtrace_formatted_session_id (webserver-wide) rather than the per-process runtime UUID. After forks, multiple workers will report the same runtime-id, reducing crash attribution granularity and making crash/runtime correlation inconsistent with normal span metadata that still uses the runtime UUID.

Useful? React with 👍 / 👎.

@bwoebi bwoebi force-pushed the bob/gloabl-session branch from 4b10ad2 to 4577655 Compare April 24, 2026 17:14
@bwoebi bwoebi force-pushed the bob/gloabl-session branch from 4577655 to b10a16b Compare April 24, 2026 17:14
@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented Apr 24, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

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

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

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Apr 24, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-04-24 18:32:06

Comparing candidate commit b10a16b in PR branch bob/gloabl-session with baseline commit b7eb412 in branch master.

Found 1 performance improvements and 4 performance regressions! Performance is the same for 189 metrics, 0 unstable metrics.

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • 🟥 execution_time [+49.791ns; +106.209ns] or [+3.406%; +7.266%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2

  • 🟥 execution_time [+63.265ns; +142.935ns] or [+4.322%; +9.764%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2-opcache

  • 🟩 execution_time [-111.119ns; -32.681ns] or [-6.898%; -2.029%]

scenario:SamplingRuleMatchingBench/benchRegexMatching3

  • 🟥 execution_time [+48.774ns; +119.626ns] or [+3.328%; +8.162%]

scenario:SamplingRuleMatchingBench/benchRegexMatching4

  • 🟥 execution_time [+69.961ns; +137.839ns] or [+4.760%; +9.377%]

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.

1 participant