Respect the path of --remote-url instead of always appending api/v1/write#196
Open
jmichalek132 wants to merge 2 commits into
Open
Respect the path of --remote-url instead of always appending api/v1/write#196jmichalek132 wants to merge 2 commits into
jmichalek132 wants to merge 2 commits into
Conversation
…rite The migration to client_golang's exp/api/remote client made remote.NewAPI join its default path (api/v1/write) onto whatever path --remote-url carries, so non-default endpoints such as Thanos Receive's /api/v1/receive became unreachable. Pass an empty API path when the URL has one, keeping the previous default for host-only URLs. Fixes prometheus-community#173 Signed-off-by: Juraj Michalek <juraj.michalek@grafana.com>
Signed-off-by: Juraj Michalek <juraj.michalek@grafana.com>
jmichalek132
force-pushed
the
fix-remote-url-path
branch
from
July 15, 2026 15:17
c988858 to
9cbc239
Compare
jmichalek132
marked this pull request as ready for review
July 15, 2026 15:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #173
Since the migration to client_golang's
exp/api/remoteclient,remote.NewAPIjoins its default path (api/v1/write) onto whatever path--remote-urlcarries. Non-default endpoints such as Thanos Receive's/api/v1/receivebecome/api/v1/receive/api/v1/writeand 404; the only workaround was pinning image v0.6.0.With this change, a
--remote-urlpath is respected, subject to the client's path cleaning (trailing and duplicate slashes are dropped; query strings and percent-encoded segments survive). Host-only URLs keep theapi/v1/writedefault. A bare/also gets the default: posting samples to/is almost never intended, so this deliberately deviates from the pre-0.7.0 behavior for that one case. Flag help updated to match.Compatibility note: URLs that relied on the current prefix behavior (
http://host/prometheusresolving to/prometheus/api/v1/write) now post to/prometheusdirectly. This restores the pre-exp-client (<= v0.6.0) behavior where the URL path was respected. If you would rather keep prefix semantics, an alternative is a dedicated path-override flag; happy to rework in that direction. The CHANGELOG entry calls this out as well.Tested with a table test covering host-only, root-path, custom-path, trailing-slash, prefix-path, query-string, escaped-segment, and double-slash URLs, for both v1 and v2 message types, against an httptest receiver.