Skip to content

Commit b3e9530

Browse files
authored
feat: Add new source-code coverage option to profilecli (#4642)
* feat: Add new source-code-coverage option to profilecli This option has a few modes: 1. `list-functions`: will list all functions found in a provided profile 2. `function`: will determine if a provided profile and provided .pyroscope.yaml config file will resolve to a source code file 3. full coverage analysis (default): will detail which functions in a provided profile resolve to a source code file given a .pyroscope.yaml A Github token is required if your .pyroscope.yaml contains github source mappings
1 parent eb8902e commit b3e9530

File tree

3 files changed

+1158
-0
lines changed

3 files changed

+1158
-0
lines changed

cmd/profilecli/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ func main() {
105105
readyCmd := app.Command("ready", "Check Pyroscope health.")
106106
readyParams := addReadyParams(readyCmd)
107107

108+
sourceCodeCmd := app.Command("source-code", "Operations on source code mappings and configurations.")
109+
sourceCodeCoverageCmd := sourceCodeCmd.Command("coverage", "Measure the coverage of .pyroscope.yaml source code mappings for translating function names/paths from a pprof profile to VCS source files.")
110+
sourceCodeCoverageParams := addSourceCodeCoverageParams(sourceCodeCoverageCmd)
111+
108112
raftCmd := adminCmd.Command("raft", "Operate on Raft cluster.")
109113
raftInfoCmd := raftCmd.Command("info", "Print info about a Raft node.")
110114
raftInfoParams := addRaftInfoParams(raftInfoCmd)
@@ -196,6 +200,10 @@ func main() {
196200
if err := ready(ctx, readyParams); err != nil {
197201
os.Exit(checkError(err))
198202
}
203+
case sourceCodeCoverageCmd.FullCommand():
204+
if err := sourceCodeCoverage(ctx, sourceCodeCoverageParams); err != nil {
205+
os.Exit(checkError(err))
206+
}
199207
case raftInfoCmd.FullCommand():
200208
if err := raftInfo(ctx, raftInfoParams); err != nil {
201209
os.Exit(checkError(err))

0 commit comments

Comments
 (0)