perf(trace): write agentless JSON directly - #2454
Conversation
Write the fixed agentless payload structure directly while retaining serde_json for all dynamic keys and values. With production-deduplicated spans, position-balanced Criterion runs on macOS arm64 improved the fixed-ID baseline by 35.44% for common HTTP traces and 20.18% for span-link traces.
📚 Documentation Check Results📦
|
🔒 Cargo Deny Results📦
|
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 3906b52 | Docs | View more details | Give us feedback! |
BenchmarksComparisonBenchmark execution time: 2026-09-03 11:53:57 Comparing candidate commit 3906b52 in PR branch Found 4 performance improvements and 2 performance regressions! Performance is the same for 139 metrics, 0 unstable metrics.
|
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
What does this PR do?
Writes fixed agentless JSON framing and field names directly into the output buffer. serde_json still owns every dynamic key, value, escape, and MessagePack conversion.
Motivation
The generic serializer state machine adds overhead for a fixed wire schema.
Additional Notes
This draft is stacked on the fixed-ID branch and contains only the JSON writer layer. Position-balanced Criterion runs improved that baseline by 35.44% for common HTTP traces and 20.18% for span-link traces.
How to test the change?
Run
cargo test -p libdd-trace-utils --lib agentless_encoderandcargo bench -p libdd-trace-utils --bench main -- agentless_encoding.