Thanks for your reply.
It is great. I will import the enforce code. https://github.com/prometheus-community/prom-label-proxy/blob/master/injectproxy/enforce.go Kind regards, Allenzh li 在 2020年12月3日 20:13,[email protected]<[email protected]> 写道: 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 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 too. -- You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/gKPOMotGzwE/unsubscribe. To unsubscribe from this group and all its topics, 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. -- 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/tencent_DF346937226F87C65BECF396%40qq.com.

