Repository: google/pprof
Pull request #894 (2024-09-18 01:19:03)

Locate symbolz endpoint with deeper paths
- `http://HOST/profilez` -> `http://HOST/symbolz`
- `http://HOST/some/deeper/path/profilez` -> `http://HOST/some/deeper/path/symbolz`

codecov-commenter: ## [Codecov](https://app.codecov.io/gh/google/pprof/pull/894?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 66.88%. Comparing base [(`0ed6a68`)](https://app.codecov.io/gh/google/pprof/commit/0ed6a68c8d9e6d5df69a1f2694c7b5c3297fdf4f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) to head [(`2c70c19`)](https://app.codecov.io/gh/google/pprof/commit/2c70c1935fbef5addcc8e2cd5fd30d2dacb97c3f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> Report is 36 commits behind head on main.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main     #894      +/-   ##
==========================================
+ Coverage   66.86%   66.88%   +0.01%     
==========================================
  Files          44       44              
  Lines        9824     9825       +1     
==========================================
+ Hits         6569     6571       +2     
- Misses       2794     2805      +11     
+ Partials      461      449      -12     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/pprof/pull/894?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/internal/symbolz/symbolz.go b/internal/symbolz/symbolz.go
index 7be3048..8d7d692 100644
--- a/internal/symbolz/symbolz.go
+++ b/internal/symbolz/symbolz.go
@@ -93,7 +93,7 @@ func symbolz(source string) string {
 		if strings.Contains(url.Path, "/debug/pprof/") || hasGperftoolsSuffix(url.Path) {
 			url.Path = path.Clean(url.Path + "/../symbol")
 		} else {
-			url.Path = "/symbolz"
+			url.Path = path.Clean(url.Path + "/../symbolz")
 		}
 		url.RawQuery = ""
 		return url.String()


Test patch:
diff --git a/internal/symbolz/symbolz_test.go b/internal/symbolz/symbolz_test.go
index e71811f..421eb88 100644
--- a/internal/symbolz/symbolz_test.go
+++ b/internal/symbolz/symbolz_test.go
@@ -31,6 +31,7 @@ func TestSymbolzURL(t *testing.T) {
 		"http://host:8000/profilez?seconds=5":                                     "http://host:8000/symbolz",
 		"http://host:8000/profilez?seconds=5&format=proto":                        "http://host:8000/symbolz",
 		"http://host:8000/heapz?format=legacy":                                    "http://host:8000/symbolz",
+		"http://host:8000/some/deeper/path/profilez?seconds=5":                    "http://host:8000/some/deeper/path/symbolz",
 		"http://host:8000/debug/pprof/profile":                                    "http://host:8000/debug/pprof/symbol",
 		"http://host:8000/debug/pprof/profile?seconds=10":                         "http://host:8000/debug/pprof/symbol",
 		"http://host:8000/debug/pprof/heap":                                       "http://host:8000/debug/pprof/symbol",