fix(native-spans): Bun-compatible transport head + UDS client stats#170
Merged
Conversation
Overall package sizeSelf size: 30.1 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------|🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Two fixes for the dd-trace-js native pipeline:
- Transport: parse the Rust-rendered HTTP/1.1 request head into
{method, path, headers} for http.request() instead of injecting it via the
Node-internal req._header. Bun's node:http ignores req._header, so trace
requests went out as POST / with no headers and the agent dropped them
(bun-runtime CI). Verified end-to-end on both Node and Bun.
- Client stats: build the /v0.6/stats URI via libdd_common::parse_uri (like the
trace exporter) so a unix:// agent URL's socket path is hex-encoded into the
URI authority and the request routes over the socket. Previously the raw parse
left the path in the URI path and stats never reached a UDS agent
(uds-express4 resource_renaming). Adds libdd-common as an explicit dep and a
pipeline test that flushes /v0.6/stats over a Unix socket.
6ed5277 to
03d2dbc
Compare
ekump
approved these changes
Jul 10, 2026
ekump
left a comment
Collaborator
There was a problem hiding this comment.
non-blocking since I know there are tests in dd-trace-js, but the parsing logic could probably be better covered in this repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two native-spans fixes for the dd-trace-js native pipeline (targets v0.16.0).
1. Bun-compatible transport request head
crates/capabilities/src/http_transport.jsinjected the Rust-rendered HTTP/1.1 request head via the Node-internalreq._header. Bun'snode:httpignoresreq._header, so under Bun trace requests went out asPOST /with no headers and the agent dropped them (dd-trace-jsbun-runtimeCI).Parse the (entity-merged) head into
{ method, path, headers }via a newparseRequestHeadand pass them totransport.request(...)— no morereq._header. Portable across Node and Bun (and no longer depends on an undocumented Node internal). Verified end-to-end: a mock-agent repro sendsPOST /v0.4/traceswithContent-Type: application/msgpack+datadog-meta-langon both Node and Bun 1.3.14.2. Client
/v0.6/statsover a Unix domain socketcrates/pipeline/src/stats.rsbuilt the stats URI with a rawformat!+ parse, so for aunix://agent URL the socket path stayed in the URI path and the request never reached the socket (dd-trace-jsuds-express4test_resource_renamingstats aggregation).Build the base URI with
libdd_common::parse_uri(exactly like the trace exporter), which hex-encodes the socket path into the URI authority (reversed by the transport'sdecode_socket_path), then append/v0.6/statsto the base path preserving the authority. Addslibdd-commonas an explicit dep (was transitive).Tests
/v0.6/statsover a real Unix socket.