When setting up alerts with GMP by rules custom resources, the PromQL expressions of alerts would be "scoped" with project_id, location, cluster, and namespace (depending on the rule scope). This is a behaviour hardcoded in the code that can't be configured by users as far as I can see.
However, for alerting on built-in GKE metrics, e.g. container/cpu/limit_utilization, the labels for cluster and namespace are cluster_name and namespace_name, according to the type spec. These labels are also not configurable.
Therefore, if I would like to to make alerts with Rules or ClusterRules on those built-in metrics, the alerts will never work due to the mismatch in labels.
The only workaround I can think of so far is to use GlobalRules to avoid scoping on cluster and namespace, but is this the only way to configure alerts on these GKE metrics, or is there any better suggestions?
Thanks :)
When setting up alerts with GMP by rules custom resources, the PromQL expressions of alerts would be "scoped" with
project_id,location,cluster, andnamespace(depending on the rule scope). This is a behaviour hardcoded in the code that can't be configured by users as far as I can see.However, for alerting on built-in GKE metrics, e.g.
container/cpu/limit_utilization, the labels forclusterandnamespacearecluster_nameandnamespace_name, according to the type spec. These labels are also not configurable.Therefore, if I would like to to make alerts with
RulesorClusterRuleson those built-in metrics, the alerts will never work due to the mismatch in labels.The only workaround I can think of so far is to use
GlobalRulesto avoid scoping onclusterandnamespace, but is this the only way to configure alerts on these GKE metrics, or is there any better suggestions?Thanks :)