Skip to content

fix(pipeline): set exporter runtime-id from the tracer#157

Merged
bengl merged 1 commit into
mainfrom
bengl/pipeline-wasm-getrandom
Jul 2, 2026
Merged

fix(pipeline): set exporter runtime-id from the tracer#157
bengl merged 1 commit into
mainfrom
bengl/pipeline-wasm-getrandom

Conversation

@bengl

@bengl bengl commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What

The WasmSpanState constructor builds a TraceExporterBuilder and sets url/service/env/hostname/app_version, but never called set_runtime_id. The runtime_id passed into the constructor was only used for the stats collector (StatsMeta), not the trace exporter. This PR passes that same runtime_id to the exporter builder.

Why

libdatadog's TraceExporterBuilder defaults runtime_id to uuid::Uuid::new_v4() at build time (libdd-data-pipeline/src/trace_exporter/builder.rs). With runtime_id unset, that default ran, which:

  1. Correlation bug — gave the trace payload a random runtime-id that did not match the stats payload's runtime-id (which already used the tracer's real runtime-id).
  2. Wasm trap — called getrandom, which panics (could not retrieve random bytes for uuidRuntimeError: unreachable) on wasm runtimes without a configured entropy source. This surfaced as widespread failures in dd-trace-js System Tests / E2E: the pipeline trapped at build_async, so no spans were ever exported.

Passing the runtime-id the caller already provides fixes both — the unwrap_or_else(Uuid::new_v4) closure never runs (no getrandom call on the build path), and the trace/stats runtime-ids match.

Test plan

  • node --test --test-force-exit test/pipeline.js → 45/45
  • node --test --test-force-exit test/http_transport.js → 6/6
  • Clean wasm rebuild; binding loads
  • The trap only reproduces in the CI/System-Tests runtime (local always has an entropy source); causation rests on the removed Uuid::new_v4() code path, verified by review.

Unblocks dd-trace-js #9139 (native-spans) System Tests / E2E.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Overall package size

Self size: 30.08 MB
Deduped: 30.08 MB
No deduping: 30.08 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------|

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

The TraceExporterBuilder set url/service/env/hostname/app_version but
never called set_runtime_id, so at build_async the builder fell back to
Uuid::new_v4(). That (a) gave the trace payload a random runtime-id that
mismatched the stats payload's (which already used the tracer's
runtime-id), and (b) called getrandom, trapping ("could not retrieve
random bytes for uuid" -> RuntimeError: unreachable) on wasm runtimes
without a configured entropy source. Pass through the runtime-id the
caller already provides.
@bengl bengl force-pushed the bengl/pipeline-wasm-getrandom branch from 5758cca to 2664938 Compare July 2, 2026 15:02
@bengl bengl marked this pull request as ready for review July 2, 2026 15:11
@bengl bengl requested review from a team as code owners July 2, 2026 15:11
@bengl bengl merged commit e83305e into main Jul 2, 2026
47 checks passed
@bengl bengl deleted the bengl/pipeline-wasm-getrandom branch July 2, 2026 15:13
@bengl bengl mentioned this pull request Jul 2, 2026
bengl added a commit that referenced this pull request Jul 2, 2026
The TraceExporterBuilder set url/service/env/hostname/app_version but
never called set_runtime_id, so at build_async the builder fell back to
Uuid::new_v4(). That gave the trace payload a random runtime-id that
mismatched the stats payload (correlation bug) and called getrandom,
which traps on wasm runtimes without a configured entropy source
(surfaced as native-spans System Tests / E2E failures). Pass through the
runtime-id the caller already provides.
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