Skip to content

Support the OTEP-4947 trace-flags byte - #404

Open
szegedi wants to merge 1 commit into
mainfrom
szegedi/trace-flags
Open

Support the OTEP-4947 trace-flags byte#404
szegedi wants to merge 1 commit into
mainfrom
szegedi/trace-flags

Conversation

@szegedi

@szegedi szegedi commented Aug 28, 2026

Copy link
Copy Markdown

When we started working on the Otel Thread Context support, the record had a reserved field, but when OTEP-4797 was finalized, it became a trace-flags byte (offset 25), which OTEP-4947 defines as the
W3C trace-flags. We need to catch up with this change.

API change

new ThreadContext(traceId, spanId, attributes?)
new ThreadContext(traceId, spanId, traceFlags?, attributes?)

traceFlags goes third, next to the ids it describes, rather than being appended after attributes. This will break callers passing attributes positionally; TypeScript rejects it at compile time, and at runtime an array in slot 3 throws
traceFlags must be an integer in 0..255. It's okay to break callers, as dd-trace-js is the only known consumer at the moment and we can make the matching change when we release pprof-nodejs.

Any integer in 0..255 is accepted rather than masked to the two bits W3C currently defines, because W3C requires unknown flag bits to be propagated. Absent / undefined / null means 0, which is what OTEP-4947 prescribes when no flags are known.

setTraceFlags()

A constructor argument alone would not be enough. dd-trace's sampling decision is deferred, so it should be possible to set the value later.

@github-actions

Copy link
Copy Markdown

Overall package size

Self size: 2.58 MB
Deduped: 3.28 MB
No deduping: 3.28 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | pprof-format | 2.3.1 | 504.33 kB | 504.33 kB | | source-map | 0.8.0 | 185.66 kB | 185.66 kB | | node-gyp-build | 4.8.4 | 13.86 kB | 13.86 kB |

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

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Aug 28, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 7 Pipeline jobs failed

DataDog/apm-reliability/pprof-nodejs | benchmarks: [18]

View more details · View in GitLab

DataDog/apm-reliability/pprof-nodejs | benchmarks: [20]

View more details · View in GitLab

DataDog/apm-reliability/pprof-nodejs | benchmarks: [22]

View more details · View in GitLab

View all 7 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: efac90b | Docs | View more details | Give us feedback!

@szegedi szegedi added the semver-minor Usually minor non-breaking improvements label Aug 28, 2026
@szegedi
szegedi marked this pull request as ready for review August 28, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor Usually minor non-breaking improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant