feat(ddtrace/tracer): reduce allocations on ETP/v1 trace protocol#4497
Conversation
BenchmarksBenchmark execution time: 2026-03-17 12:44:54 Comparing candidate commit 78b1651 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 155 metrics, 9 unstable metrics.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
kakkoyun
left a comment
There was a problem hiding this comment.
LGTM.
Could we add a comparison table to the PR description? It would be easier to reason about the changes.
|
@kakkoyun Done! |
|
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 78b1651 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
|
@darccio Feel free to merge this as admin. |
|
|
What does this PR do?
Adds a
payloadpool and reuse logic for ETP/v1 payload internals.Motivation
Reduce allocations as described below.
Here's the benchmark comparison table extracted from the PR:
ETP/v1 Payload Benchmark: Before vs After (with pool)
v0.4 baseline (reference)
Key takeaway: the pool brings v1.0 allocations from 20–44 allocs/op down to just 1–2 allocs/op, and cuts per-op heap allocation by 97x–3,679x depending on trace size. Latency also improves 1.2–2.9x. The v1.0-with-pool now closely matches the v0.4 baseline in allocation count, while the bytes-per-op is far lower for large traces (61 B vs 237 KB for 1,000 spans).
Original results
Baseline
Optimized (pooled):
Optimized (unpooled):
Reviewer's Checklist
make lintlocally.make testlocally.Unsure? Have a question? Request a review!