Guard TCP input debug logging with IsDebug() to halve per-event allocations#49737
Guard TCP input debug logging with IsDebug() to halve per-event allocations#49737
Conversation
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Agent-Logs-Url: https://github.com/elastic/beats/sessions/a6f371a4-cf63-4b2e-8596-5b63bc4f773b Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
|
/ai are there other TCP benchmarks which show improvement with this change? |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe TCP input ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
- Use (*net.ListenConfig).Listen instead of net.Listen (noctx) - Fix typo: initalises → initialises - Lowercase error string (ST1005) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Debugwin the TCP input hot path unconditionally constructs structured log args (includingRemoteAddr.String()) for every received packet, even when debug is disabled. This adds ~500 allocations/op on the ingest path.Debugwcall withctx.Logger.IsDebug(), consistent with the existing pattern used throughout the codebase (kafka client, autodiscover, CEL input, etc.)Benchmark results: 1014 → 518 allocs/op (−49%), no throughput regression.
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.