-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding web.external-url and web.route-prefix flags #515
Adding web.external-url and web.route-prefix flags #515
Conversation
8b1434b
to
c2845ed
Compare
Signed-off-by: Sven Nebel <[email protected]>
c2845ed
to
67a8809
Compare
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.
I'm happy to change the behavior if forcing absolute path is what we want.
Let's go with consistency.
May be creating something like https://github.com/prometheus/common/tree/master/promlog even trying to get the flags packed there, then implement in both blackbox_exporter and alertmanger and take a look to see if those flags are implemented anywhere else, but I would appreciate feedback on this point before doing anything.
Probably best to do that with the TLS stuff when it's moved over to common. It's also in the pushgateway.
@SuperQ FYI
main.go
Outdated
w.Write([]byte(" <body>\n")) | ||
w.Write([]byte(" <h1>Blackbox Exporter</h1>\n")) | ||
|
||
w.Write([]byte(fmt.Sprintf(" <p><a href=\"%s/probe?target=prometheus.io&module=http_2xx\">Probe prometheus.io for http_2xx</a></p>\n", *routePrefix))) |
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.
We could use relative paths here, the blackbox exporter doesn't do anything fancy.
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.
Great, since they are already relative urls I'll keep the code in this area the same then
Sorry for bothering again, but let's see if I understood correctly
The only places were we could be using the absolute url value coming from
It's therefore my understanding that we are already consistent and ok on this point.
I'm not sure what you mean by In any case my understanding is that you would want to address moving Is this PR then ok to be merged? |
I meant consistent in the checks it performs. Having the semantics different across different servers would be confusing.
It's in progress in the node exporter currently, and it'd make sense for all this code to be together at some future point. |
I agree, I took the logic from the |
I will double-check Here is a recently implemented example prometheus/pushgateway#190 which code I could reuse I guess, allowing to be moved on to common later on. |
7445d4a
to
515249d
Compare
Signed-off-by: Sven Nebel <[email protected]>
d603eeb
to
2afe4f0
Compare
Signed-off-by: Sven Nebel <[email protected]>
2afe4f0
to
3d02120
Compare
Signed-off-by: Sven Nebel <[email protected]>
Signed-off-by: Sven Nebel <[email protected]>
@brian-brazil I reviewed prometheus behavior for From what I can see, only one behaviour will remain different between prometheus <> blackbox_exporter after merging this PR, currently blackbox_exporter matches any non registered path to the landing page, see here, while prometheus return 404s when a path wasn't explicitly registered, but this the case already before this PR. This is hard to match due to using ServeMux in blackbox_exporter vs I guess in the future, migrating over I hope this makes sense now, but please let me know otherwise. Cheers |
Signed-off-by: Sven Nebel <[email protected]>
How about that? |
Thanks! |
Hi,
First all, let's make it clear that this is my first contribution within the Prometheus ecosystem, but hopefully not the last one.
This PR aims to fix #475 making several assumptions and having different feelings on the way.
alertmanager
andprometheus
which seems to implement the same flags, I essentially copied the same logic adapting for the specifics of this component.--web.external-url
is set, since all links are anyway relative reusing the original domain, I guess in other components more complex such as prometheus or alertmanager this might be necessary. I'm happy to change the behavior if forcing absolute path is what we want.Since this component is so simple I've coded this PR using the naive approach, but I feel it probably makes sense to move the following function with its test case to https://github.com/prometheus/common since the same function is used in the alertmanager as well (In fact It was literally copied from there)
May be creating something like https://github.com/prometheus/common/tree/master/promlog even trying to get the flags packed there, then implement in both
blackbox_exporter
andalertmanger
and take a look to see if those flags are implemented anywhere else, but I would appreciate feedback on this point before doing anything.