Skip to content

Conversation

@harp-intel
Copy link
Contributor

This pull request refactors how the perf binary is managed and invoked in the metrics collection workflow. The main change is the removal of logic for extracting, locating, and pushing a custom perf binary to targets; instead, the code now assumes that perf is available on the system PATH. Additionally, the code for constructing and running the perf command has been simplified to use a string-based command rather than an exec.Cmd object. This streamlines the codebase and reduces complexity around binary management.

Refactoring of perf binary management and command construction:

  • Removed all logic related to extracting, locating, and pushing a custom perf binary to targets; the system now assumes perf is available on the system PATH and uses "perf" directly in script templates and command construction. (cmd/metrics/metrics.go, cmd/metrics/perf.go, cmd/metrics/metadata.go) [1] [2] [3] [4] [5] [6]
  • Refactored the getPerfCommand function to return a string command instead of an exec.Cmd object, simplifying how the perf command is assembled and executed. (cmd/metrics/perf.go, cmd/metrics/metrics.go) [1] [2] [3] [4]
  • Updated all related function signatures and calls to remove the perfPath parameter, including in metadata collection and script definitions. (cmd/metrics/metadata.go, cmd/metrics/metrics.go) [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Updated script definitions to use "perf" directly in the ScriptTemplate field and added explicit dependencies on perf where appropriate. (cmd/metrics/metadata.go) [1] [2]
  • Removed unused code and variables related to custom perf binary handling, such as perfPath in targetContext and the extractPerf/getPerfPath functions. (cmd/metrics/metrics.go, cmd/metrics/perf.go) [1] [2] [3]

These changes should make the code easier to maintain and deploy, as it no longer requires managing a custom perf binary for each target system.

Signed-off-by: Harper, Jason M <[email protected]>
Signed-off-by: Harper, Jason M <[email protected]>
@harp-intel harp-intel requested a review from Copilot November 30, 2025 17:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the perf binary management in the metrics collection workflow by eliminating custom binary extraction and deployment logic. Instead of managing a bundled perf binary and pushing it to targets, the code now assumes perf is available on the system PATH. The refactoring simplifies the codebase by removing approximately 80 lines of binary management code and changing getPerfCommand to return a string command instead of an *exec.Cmd object.

Key changes:

  • Removed extractPerf and getPerfPath functions that handled custom perf binary extraction and deployment
  • Changed getPerfCommand to return a string command instead of *exec.Cmd
  • Updated metadata collection to use the script module's dependency management for perf

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
cmd/metrics/perf.go Removed binary extraction/path resolution functions; refactored getPerfCommand to return string command
cmd/metrics/metrics.go Removed perfPath from targetContext; eliminated local binary extraction; updated function signatures
cmd/metrics/metadata.go Removed perfPath parameter from metadata collection; added explicit perf dependencies to script definitions

@harp-intel harp-intel merged commit 9693ca7 into main Nov 30, 2025
5 checks passed
@harp-intel harp-intel deleted the perfresource branch November 30, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants