-
Notifications
You must be signed in to change notification settings - Fork 112
Respect the path of --remote-url instead of always appending api/v1/write #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jmichalek132
wants to merge
4
commits into
prometheus-community:main
Choose a base branch
from
jmichalek132:fix-remote-url-path
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cc03dfa
Respect the path of --remote-url instead of always appending api/v1/w…
jmichalek132 9cbc239
Document --remote-url path behavior and existing remote write v2 flag
jmichalek132 3baa985
Split --remote-url into base URL and API path
jmichalek132 5099ae5
Reject --remote-url paths with an escaped separator
jmichalek132 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this option is sort of tricky to use.
I think originally we thought clients would dedicatedly build paths this way so, you could pass in URL with path of metrics/v1/tenant and call WithAPIPath("api/v1/receive") or so.
I think a cleaner option here, might be to parse the URL from the flag, and split url and path when calling remote.NewAPI and WithAPIPath?
Or we can think about changing behaviour on the exp module, so that if it detects path, it won't append default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, took your first suggestion:
3baa985splits the flag's URL, base toremote.NewAPIand path toWithAPIPath. Host-only URLs and a bare/still get theapi/v1/writedefault.One wrinkle it introduces:
NewAPIjoins intourl.URL.Pathand leavesRawPathalone, so the endpoint sees the decoded path. Harmless for unreserved characters (/ten%61ntposts to/tenant), but%2Fexists to stop a slash being a segment boundary, so/tenant%2Freceivewould quietly post to/tenant/receive.5099ae5rejects that instead of rewriting it.If you'd rather not carry that validation, your second idea solves it properly: an
expoption meaning "this URL is the exact endpoint", skipping the default and leaving the parsed URL untouched, would preserveRawPath. Happy to open that PR.