feat: allow retaining cmperf CM2 temp files for debug - #4392
Merged
Conversation
Add HARVEST_CMPERF_RETAIN_FILES so CM2 pb files can be kept for troubleshooting,
with newest-N pruning.
Isolate temp dirs as
cmperf-{poller}-{uid}/{object} so different Unix users do not collide.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in debugging mechanism for CMPerf CM2 protobuf downloads by retaining the newest N temp .pb files (via HARVEST_CMPERF_RETAIN_FILES) and reduces temp-dir collisions by isolating temp directories per poller and Unix user.
Changes:
- Introduces
HARVEST_CMPERF_RETAIN_FILESparsing and temp-directory pruning logic (newest-N retention). - Updates CMPerf temp directory layout to
cmperf-{poller}-{uid}/{object}under the chosen temp root. - Adds unit tests for retain parsing and pruning behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/collectors/cmperf/cmperf.go | Changes CM2 temp-dir path to include poller + UID + object for better isolation. |
| cmd/collectors/cmperf/cm2.go | Adds retention env var handling and pruning logic; integrates pruning into download/parse lifecycle. |
| cmd/collectors/cmperf/cm2_test.go | Adds tests covering retain parsing and pruning “keep newest N” semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add HARVEST_CMPERF_RETAIN_FILES so CM2 pb files can be kept for troubleshooting,
with newest-N pruning.
Isolate temp dirs as
cmperf-{poller}-{uid}/{object} so different Unix users do not collide.
rahulguptajss
approved these changes
Aug 7, 2026
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.
Add HARVEST_CMPERF_RETAIN_FILES so CM2 pb files can be kept for troubleshooting, with newest-N pruning.
Isolate temp dirs as
cmperf-{poller}-{uid}/{object} so different Unix users do not collide.