perf: remove unnecessary allocations in hot-path processors#49761
perf: remove unnecessary allocations in hot-path processors#49761strawgate wants to merge 1 commit intoelastic:mainfrom
Conversation
🤖 GitHub commentsJust comment with:
|
This comment has been minimized.
This comment has been minimized.
354881f to
f76705a
Compare
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (10)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR reduces unnecessary allocations in several hot-path processors and adds benchmarks. Changes: test assertion in event test switched to exact string equality; Docker metadata now merges metadata without cloning; Kubernetes metadata clones only the container sub-map when building OCI container fields; timestamp parsing defers allocation of detailed errors and centralizes failure logging; publisher meta merging omits an unused clone. Added benchmarks for Docker metadata, Kubernetes annotator, and timestamp. A changelog fragment records the enhancement. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
fd947b4 to
30dd186
Compare
Remove wasteful Clone() calls and defer allocations in docker metadata, kubernetes metadata, timestamp, and publisher/processing processors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cd1b5d2 to
d721bd4
Compare
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Summary
Remove unnecessary allocations in four hot-path processors. Each change is a targeted removal of wasteful
Clone()calls or deferred allocation — no new APIs, no behavioral changes.Changes
Clone()of a locally-built map that is never reused. Also updates deprecatedcgroup.NewReader→cgroup.NewReaderOptions.Clone()calls to 1 full clone + 1 container sub-clone. The removed clone wasmetaClone.Clone().GetValue()whereGetValueis read-only.parseErrorallocation to the failure path. Previously allocated on every call regardless of outcome.event.Meta.Clone()whose return value was never captured.Per-processor benchmarks
Test plan
🤖 Generated with Claude Code