'How to exclude multiple labels from Prometheus Query?

I want to exclude mulitple app groups from my query... Not sure how to go about it.. My thoughts are like this

count(master_build_state{app_group~! "oss-data-repair", "pts-plan-tech-solution", kubernets_namespace = "etc"} ==0) 

I do not want to include those two app_groups, but am not sure how to implement in PromQL. You would thing to add () or [], but it throws errors. Let me know if anyone can help!

Thanks



Solution 1:[1]

count(master_build_state{app_group !~ "(oss-data-repair|pts-plan-tech-solution)", kubernets_namespace="etc"} ==0)

Solution 2:[2]

you can use the != comparison binary operator to do that. Just write it twice on your promQL.

count(
  master_build_state{
    app_group!="oss-data-repair", 
    app_group!="pts-plan-tech-solution",
    kubernets_namespace="etc"} 
== 0) 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert Hunt
Solution 2 Knoblauch