QubitProducts / exporter_exporter

A reverse proxy designed for Prometheus exporters
Apache License 2.0
332 stars 55 forks source link

Transition option to keep the route for a default module #88

Closed anisse closed 1 year ago

anisse commented 1 year ago

It's often the case that there's already an exporter in place, and one might want to add another. exporter_exporter has the nice property of listing all the exporters it reverse proxies, listen on a single port, etc.

But at scale, changing the address of all targets from /metrics to /proxy?module=previous-exporter at the same time is often not feasible. It might be desirable to keep the existing route working during a transition.

Would you be review to a pull request for this ? The goal would be add an option for overriding the /metrics and maybe / route by the route of a module that is being replaced.

tcolgate commented 1 year ago

I'm not quite sure I understand the suggestion (the last sentence isn't quite adding up). Could you show an example config, and what the behaviour would be (how it differs from the current setup).

anisse commented 1 year ago

The goal would be to replace exporter_exporter's /metrics with a given module. My use case would be to replace an exporter endpoint in-place, transparently, on the same port, before adding more modules.

Before:

After:

The config would look like this:

modules:
    node:
    method: http
    http:
       address: 127.0.0.1
       port: 9100
transition_module: node

Now in my case it's a collectd's write_prometheus that I want to replace. Unfortunately this exporter has no router replies with the metrics on any path (!). To be safe I wanted to also replace the / route, but this might be erring too much on the side of caution.

I don't know yet what to do with exporter_exporter's own /metrics route. Maybe make it available at some other path during the transition.

tcolgate commented 1 year ago

TBH this seems very niche. Why not:

tcolgate commented 1 year ago

Perhaps a better options would be for exporter_exporter to allow a default module to be configured, then you could set the --web.proxy-path=metrics --web.telemetry-path=/expexp_metrics, and I think you'd get what you want

anisse commented 1 year ago

I agree, it looks pretty niche. We'll probably use the exact plan you proposed since it's simpler. I would have liked something like what you proposed since it allows to do the migration in-place, but it's not a hard requirement. Let's close this issue.

tcolgate commented 1 year ago

v0.5.0 includes the support for a defaultModule configuration option. I think that, in combination with the configuration for alternate paths for proxy and telemetry metrics would be enough to achieve your original request.