prometheus/cmd/promtool
kigland f6dae733c5 promtool: fix check healthy/ready failing with trailing slash in URL
CheckServerStatus built the request URL by concatenating the
user-provided URL with the endpoint path:

    serverURL.String() + checkEndpoint

When the URL ends with a slash (e.g. "http://localhost:9090/"), this
produces a doubled slash like "http://localhost:9090//-/healthy". The
Prometheus router registers "/-/healthy" and "/-/ready" exactly and
does not collapse repeated slashes, so the request 404s and
"promtool check healthy" / "promtool check ready" fail.

Use url.JoinPath to append the endpoint, which normalises the slash and
also handles a configured route prefix correctly. JoinPath returns a new
URL, so the original is left untouched for the error message.

Signed-off-by: kigland <shuaizhicheng336@gmail.com>
2026-06-04 18:29:00 +08:00
..
testdata promtool: support missing promql syntax features (#17926) 2026-02-09 07:26:37 +00:00
analyze.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
analyze_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
archive.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
backfill.go Refractor promtool errors (#17842) 2026-01-13 06:35:11 +00:00
backfill_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
debug.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
main.go promtool: fix check healthy/ready failing with trailing slash in URL 2026-06-04 18:29:00 +08:00
main_test.go promtool: fix check healthy/ready failing with trailing slash in URL 2026-06-04 18:29:00 +08:00
metrics.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
metrics_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
query.go promtool: add --header flag to query instant command 2026-04-01 17:10:56 +08:00
rules.go Replace per-component parser options with default instance 2026-02-11 11:16:04 +01:00
rules_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
sd.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
sd_test.go scrape: add __convert_classic_histograms_to_nhcb__ internal label (#18840) 2026-06-03 13:11:21 +00:00
tsdb.go chore: fix emptyStringTest issues from gocritic (#18226) 2026-03-04 08:24:50 +01:00
tsdb_posix_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
tsdb_test.go Refactor parse.go into an instance-based Parser interface 2026-02-11 11:21:49 +01:00
unittest.go promtool: redirect debug output to stderr (#18346) 2026-03-24 12:12:54 +01:00
unittest_test.go Refactor parse.go into an instance-based Parser interface 2026-02-11 11:21:49 +01:00