Skip to content
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

Make all URLs relative to support proxies. #528

Closed
wants to merge 1 commit into from
Closed

Conversation

juliusv
Copy link
Member

@juliusv juliusv commented Feb 14, 2015

This makes all URLs relative instead of absolute to enable people to run
Prometheus behind a Proxy with a different path (like
http://myproxy/prometheus/).

The caveat is that this now codifies assumptions for the relative path
depths for all pages. For example, consoles templates are now always
assumed to be one path level from the root (because the common header
and console library adds '../' to all their URLs). Currently we don't
have example consoles in subdirectories of "consoles", but this would
disallow that for the future (or we could add later support for
detecting somehow what the right depth is based on the console file
we're loading).

This fixes #519

@juliusv
Copy link
Member Author

juliusv commented Feb 14, 2015

@brian-brazil I tested both the node-exporter and haproxy templates, but I couldn't test every other example template out there. Would be good if you could double-check that everything looks sane and works for you.

@juliusv
Copy link
Member Author

juliusv commented Feb 14, 2015

@beorn7

@@ -153,12 +153,12 @@ func TableLinkForExpression(expr string) string {
// See also:
// http://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20.
urlData := url.QueryEscape(fmt.Sprintf(`[{"expr":%q,"tab":1}]`, expr))
return fmt.Sprintf("/graph#%s", strings.Replace(urlData, "+", "%20", -1))
return fmt.Sprintf("graph#%s", strings.Replace(urlData, "+", "%20", -1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work, console templates could be any number of directories deep.

@brian-brazil
Copy link
Contributor

I don't think this is workable in the general case, and it will break future use cases I have planned that involve separate directories (it's a good way to separate out what's allowed external access for things like metamonitoring).

May I suggest separate DNS names?

@juliusv
Copy link
Member Author

juliusv commented Feb 15, 2015

It was requested by @yorik in #519, so I'm not sure how much flexibility there is in just using a different DNS name with root path (sounds reasonable to me personally).

Ok, so this has to wait then unless I or someone else adds automatic detection for the correct relative paths. Shouldn't be hard, just adds a bit of extra code complexity, especially with injecting it into the static JS assets which call /api.

This makes all URLs relative instead of absolute to enable people to run
Prometheus behind a Proxy with a different path (like
http://myproxy/prometheus/).

The caveat is that this now codifies assumptions for the relative path
depths for all pages. For example, consoles templates are now always
assumed to be one path level from the root (because the common header
and console library adds '../' to all their URLs). Currently we don't
have example consoles in subdirectories of "consoles", but this would
disallow that for the future (or we could add later support for
detecting somehow what the right depth is based on the console file
we're loading).

This fixes #519
@beorn7
Copy link
Member

beorn7 commented Apr 7, 2015

That's superseeded by #614 now, right?

@juliusv
Copy link
Member Author

juliusv commented Apr 13, 2015

Yep. Closing.

@juliusv juliusv closed this Apr 13, 2015
@juliusv juliusv deleted the relative-urls branch April 13, 2015 10:52
simonpasquier pushed a commit to simonpasquier/prometheus that referenced this pull request Oct 12, 2017
instrumenting: add Rust client library link.
codesome pushed a commit to codesome/prometheus that referenced this pull request Jul 29, 2019
…rrect number of records. (prometheus#528)

Test to corrupt segments mid-WAL, repair and check we can read the correct number of records.

Make segmentBufReader pad short segments with zeros, and only advance curr segment index after fully reading segment.
ywwg pushed a commit that referenced this pull request Jan 9, 2024
…ues-from-series

Check storage.ErrNotFound in labelValuesFromSeries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add flag/config option to set root directory for UI
3 participants