fix: use upstream path in modify response
Some open-source projects expose a Prometheus-compatible API at at a subpath, e.g. /prometheus. We should use the upstream.Path configured when matching the resp.Request.URL.Path in ModifyResponse so that we can handle the case of a non-root upstream path when proxying /api/v1/rules and /api/v1/alerts.
Hi @seanbanko can you add a concrete test case? Otherwise I'm sure this will regress
Hi @seanbanko can you add a concrete test case? Otherwise I'm sure this will regress
Great call. I've added a simple test case to TestRules that fails if the upstream path concatenation is removed from r.modifiers.
I copied rules_match_namespace_ns1.golden to rules_match_namespace_ns1_non_root_upstream.golden to make the purpose of the test clear, but we could also just use rules_match_namespace_ns1.golden in the test instead to make it clear that the expected result is the same.
@squat just bumping this. Is that test case is sufficient?
Just taking a look at recent commits, @simonpasquier are you able to review?
Looks like the tests are failing.
I just re-ran the tests and they are still failing. ping @seanbanko
@squat @SuperQ fixed, sorry about that.
Just following up here. Anything I can do to help get this merged?
@simonpasquier let me know if I can do anything to help get this over the line!