On Thursday, 3 December 2020 at 09:17:02 UTC [email protected] wrote: > The problem is how to add the matcher to a exist rule expr. > > > Eg. > > > Now the rule expr is : > > cpu_usage / avg_over_time(cpu_usage[5m] offset 24h) > 2 > > Which is desired: > > cpu_usage{xxId="xxx"} / avg_over_time(cpu_usage{xxId="xxx"}[5m] offset 24h) > > 2 > > prom-label-proxy <http://prom-label-proxy does the sort of label enforcement you're talking about.> does this sort of label application. You may be able to steal code from it to do the query rewriting you want.
What's the underlying reason for wanting to do this? Are you building some sort of multi-tenant setup? If so, there may be other solutions. Cortex and VictoriaMetrics have native multi-tenant support; and I think Thanos has some support <https://thanos.io/tip/operating/multi-tenancy.md/> too. -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/c13d2755-ac41-4b31-ae8d-6c4b94c2a56en%40googlegroups.com.

