Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign updefault route prefix to root #2813
Comments
brancz
added
the
dev-2.0
label
Jun 6, 2017
This comment has been minimized.
This comment has been minimized.
Some load balancers have that ability, not all. I believe the current behaviour is correct. |
This comment has been minimized.
This comment has been minimized.
|
This is about the default for |
This comment has been minimized.
This comment has been minimized.
That's a standard thing when you're prefixing, it only works otherwise for simple cases.
I don't think this is a sane setup for us to try and support. |
This comment has been minimized.
This comment has been minimized.
|
It also comes down to Prometheus to Alertmanager communication, does it really make sense for Prometheus to fire alerts against |
This comment has been minimized.
This comment has been minimized.
If that's what the user has setup via their proxies, then yes. |
This comment has been minimized.
This comment has been minimized.
Example, I expose my Prometheus servers publicly with locked down write endpoints behind
Yes, of course. That's why this discussion is about changing the default we chose for this flag to what I believe is the sane choice. |
This comment has been minimized.
This comment has been minimized.
Not really. To do this in general the server would need to be aware of the different prefixes for the different domains so that it can use the correct prefix in responses. |
This comment has been minimized.
This comment has been minimized.
|
That's a natural limitation, though I disagree that this means that setup won't happen frequently enough. But also it doesn't matter for the discussion. Our thesis is: the sane behavior for an LB is to truncate the prefix when passing down a request. We would like to adjust the default to reflect that. This does not prevent anyone from doing it differently. Taking the same problem to Alertmanager: Imagine Prometheus discovers AM pods in Kubernetes and wants to send them alerts via That argument translates equally to Prometheus – also Prometheus and AM should obviously be consistent with their flag defaults. |
This comment has been minimized.
This comment has been minimized.
I don't think that's a safe assumption. It's not the Apache default for example.
It may not work, because we have to choose some setup that won't work by default.
There is no such thing as "internal" traffic, there is only traffic. If you make some endpoints disregard the prefix, then you break proxies that don't remove the prefix. |
This comment has been minimized.
This comment has been minimized.
|
And the current default breaks everything because anyone communicating needs to know whatever LB might have been setup. There's absolutely such a thing as internal traffic. That's the very reason why in K8S for example, every pods gets its own IP, so we don't have to globally handle collisions on ports and paths and can decouple any ingress (i.e. external/user) traffic from how applications talk to each other. |
This comment has been minimized.
This comment has been minimized.
|
From our perspective there's no such thing as internal traffic, there's http requests arriving at our endpoints and no way for us to tell what organisation specific semantics they have in terms of being internal/external (nor should there be). Do you have examples of specific requests you believe it'd be sane to treat differently based on the http request? |
This comment has been minimized.
This comment has been minimized.
|
This is not about treating anything differently. This is about changing a default flag value – nothing else. No mention of treating any traffic differently in any way at all from the Prometheus side. |
This comment has been minimized.
This comment has been minimized.
|
I had missed that. If we're going to be making a breaking change hear we should get an idea of how many users will break vs benefit. |
This comment has been minimized.
This comment has been minimized.
|
IMHO most examples for apache and nginx don't rewrite paths, but both support it. Kubernetes proxy rewrites the path by default. From a user standpoint, I think it's easier to understand the behavior if a flag's default value doesn't depend on the value of another flag. I'm slightly in favor of this change, but I fear all the confused questions with this change. I guess we'll need to write a very good and detailed upgrade howto guide. |
brian-brazil
added
priority/Pmaybe
component/ui
labels
Jul 14, 2017
This comment has been minimized.
This comment has been minimized.
StianOvrevage
commented
Oct 12, 2017
|
I came to report this as a bug. But after reading the comments I found out it could be fixed with the route-prefix luckily :-) Background: My setup is Kubernetes which does URL rewriting by default. Also, in my previous nginx-load-balancer deployments I use upstreams and proxy_pass which also by default will implicitly rewrite to /. Prometheus is the only application I have run that has this default behaviour. Grafana, Kibana, Elasticsearch etc all works by default from the root route, and only uses external-url for prefixing URLs in served code. In my current deployment only the first gateway (Kubernetes Ingress load balancer) has knowledge about the actual client URL being used. So the second application-nginx-server which also proxies to Prometheus has no way of knowing the actual URL served to the client at any given time, and hence which sub-route to call Prometheus on. |
This comment has been minimized.
This comment has been minimized.
|
I guess we missed the chance to change the flag behavior. @brancz shall we close this one? |
This comment has been minimized.
This comment has been minimized.
|
I've been wanting to write some user-guides on how to use the respective flags in different situations. Once we have that the situation should already be a lot better. I'm fine with closing this. |
brancz
closed this
Nov 13, 2017
This comment has been minimized.
This comment has been minimized.
carlpett
commented
Nov 14, 2017
|
@StianOvrevage @brancz Until those guides are in place, what is the recommended combination of flags for k8s and web.external-url/web.route-prefix? My use case, and what I believe you were discussing as well, is having Prometheus primarily served (through an ingress) at https://some-domain/prometheus. I've set |
This comment has been minimized.
This comment has been minimized.
|
That is the currently expected behavior. What alertmanager actually does is ensure, that the loaded URL ends with a slash and redirect if it doesn’t. From there on onwards, it only performs requests relative to that path, which is why even after rewriting the URL everything works perfectly, however because it’s just a relative request, this continues to work with nodeport/port-forward. Not sure whether adopting this behavior in Prometheus would be considered breaking, but I think it would be an great UX improvement. |
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
brancz commentedJun 6, 2017
Currently the
-web.route-prefixdefaults to the path portion of-web.external-url. This makes it difficult for other components to communicate with the Prometheus API (for example Grafana), as it will need to know about the prefix, just for communication between the two applications. Load balancers and proxies have the ability and sometimes even default to rewriting request URLs to root anyways so it seems like a more sane choice to not prefix the API or in fact any HTTP endpoint.My idea is that the
-web.external-urlis merely about user interaction as in, it is used for redirects, templating and for back-links in alerts.While this is a small change, it is breaking so I am proposing to change this for the Prometheus 2.0 release.