prom-label-proxy icon indicating copy to clipboard operation
prom-label-proxy copied to clipboard

fix: use upstream path in modify response

Open seanbanko opened this issue 11 months ago • 10 comments

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.

seanbanko avatar Feb 06 '25 21:02 seanbanko

Hi @seanbanko can you add a concrete test case? Otherwise I'm sure this will regress

squat avatar Feb 06 '25 21:02 squat

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.

seanbanko avatar Feb 06 '25 23:02 seanbanko

@squat just bumping this. Is that test case is sufficient?

seanbanko avatar Feb 21 '25 17:02 seanbanko

Just taking a look at recent commits, @simonpasquier are you able to review?

seanbanko avatar Feb 21 '25 20:02 seanbanko

Looks like the tests are failing.

SuperQ avatar Jun 05 '25 05:06 SuperQ

I just re-ran the tests and they are still failing. ping @seanbanko

squat avatar Jun 16 '25 15:06 squat

@squat @SuperQ fixed, sorry about that.

seanbanko avatar Jul 03 '25 18:07 seanbanko

Just following up here. Anything I can do to help get this merged?

seanbanko avatar Aug 14 '25 03:08 seanbanko

@simonpasquier let me know if I can do anything to help get this over the line!

seanbanko avatar Aug 25 '25 15:08 seanbanko