Add args to serve application behind a route prefix/external URL
This is a duplicate of #1328 Sorry for the duplicate. Didn't realize deleting my branch would auto-close the pull request. Anyways... 🤦♂️
Add feature to serve application behind a route prefix or external URL by supplying args --web.external-url/--web.route-prefix, in the same way as blackbox_exporter or other exporters.
I am also submitting a pull request for exporter-toolkit so that this will actually work. Currently you cannot serve the landing page on anything other than root ("/"), so the tests are going to fail initially.
I would consider these additional args to be "must-have" features to bring snmp_exporter closer to feature parity with the other exporters. I needed to serve this exporter behind a prefix like I'm doing with the other exporters, so I figured I would make an attempt at this update myself, as it does appear to be something other people have been wanting for quite some time. See: #648
Supporting exporter-toolkit pull request: https://github.com/prometheus/exporter-toolkit/pull/283
we need a new version from the https://github.com/prometheus/exporter-toolkit before we can get this merged @SuperQ any plans for a release of the exporter-toolkit already?
I have released an update to the exporter-toolkit. (#1360)
Needs some go fmt.
pprof profile - endpoint debug/pprof/profile now 404's when --web.external-url is set, without snmp_exporter just crashes:
panic: pattern "/debug/pprof/heap" (registered at /home/basti/exporter-prefix/main.go:354) conflicts with pattern "GET /debug/pprof/" (registered at /usr/local/go/src/net/http/pprof/pprof.go:100):
/debug/pprof/heap matches more methods than GET /debug/pprof/, but has a more specific path pattern
The pprof endpoints are not configurable easily. We would have to custom register our own handlers.
We basically need to completely re-work how we handle the web endpoint for exporters to handle this better. Really, I don't think we should be doing this at all. This is too much extra boilerplate and makes our exporters inconsistent.
The fact that this has been hand-implemented by the blackbox exporter, and this PR is a mess of additional code, shows that we should not be doing this.
This is far too much boilerplate as-is. I will not merge this until it is simpler for exporter maintainers to add universally across the ecosystem.
I have attempted to do this in this pull request https://github.com/prometheus/exporter-toolkit/pull/293
Hello everyone - is there still someone working on this particular enhancement? This would be super useful.
Hello everyone - is there still someone working on this particular enhancement? This would be super useful.
I worked on this several months ago (nearly a year at this point) and have been using it in a production environment ever since without issue. This feature depends on this 8 month old PR to get merged, which hasn't yet been acknowledged by maintainers. Until that's merged, the tests on this will continue to fail. I'm not a Go developer, so I would appreciate anyone taking initiative to improve/fix my code on either PR to get this merged.