From f3f46ee36851068720c1cc883e763bd8a0d6a022 Mon Sep 17 00:00:00 2001 From: Shoban Chandrabose Date: Fri, 27 Sep 2024 19:30:43 -0400 Subject: [PATCH] Locate symbolz endpoint with deeper paths (#894) - `http://HOST/profilez` -> `http://HOST/symbolz` - `http://HOST/some/deeper/path/profilez` -> `http://HOST/some/deeper/path/symbolz` Co-authored-by: Alexey Alexandrov --- internal/symbolz/symbolz.go | 2 +- internal/symbolz/symbolz_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/symbolz/symbolz.go b/internal/symbolz/symbolz.go index 7be304866..8d7d69288 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() diff --git a/internal/symbolz/symbolz_test.go b/internal/symbolz/symbolz_test.go index e71811f3c..421eb88ac 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",