Closed brettimus closed 1 year ago
Additionally, I figured we would need to rewrite the path of any requests to /prometheus/* before forwarding to the external prometheus. There has to be a better/more concise way than I chose.
I think this is the correct way of dealing with this :+1:
Basically, this PR still needs some cleanup, api review (is proxy the right command name even?), and probably some tests.
I think proxy
is the best name.
Description
This PR adds support for an
am proxy
command, which would--listen-address
and--explorer-address
)/prometheus
to a user-specified url (configured via--prometheus-url
)So, if we already had prometheus running on
http://localhost:8063
for some odd reason, we could run:And
am
would not download/launch prometheus, but explorer would still be accessible and automagically connected to the Prometheus instance we're interested in connecting to.For what it's worth, I tested that scenario, and it does indeed work.
Where I need help
I wanted to create a handler factory, but struggled immensely with the type definition, because you can't use
impl Trait
to describe the return type for aFn
trait (https://github.com/rust-lang/rust/issues/99697).What I wanted was something that looked like:
Ultimately, I gave up, and opted to use inline blocks/closures to define the handlers for this functionality.
Additionally, I figured we would need to rewrite the path of any requests to
/prometheus/*
before forwarding to the external prometheus. There has to be a better/more concise way than I chose.Basically, this PR still needs some cleanup, api review (is
proxy
the right command name even?), and probably some tests.Checklist