Hi , i am trying to write alerting in promql for this condition: "Trigger alert in case any metric has a cardinality higher than the defined threshold (TBD)"

  • What Grafana version and what operating system are you using?
    i dont have correct version but it is a cloud grafana , I think it is latest one or before it

  • What are you trying to achieve?
    hi , i am trying to write alerting in promql for this condition: “Trigger alert in case any metric has a cardinality higher than the defined threshold (TBD)” and threshold is 100

  • How are you trying to achieve it?
    i wrote below query :
    topk(20,count by(name)({name=~“zs.+”})) > 100
    here “zs” means metrics starting with zs name

  • What happened?
    it is giving output for a metric with total possible combinations

  • What did you expect to happen?
    i want cardinality of a metric can you help who to get cardinality odf a metric in k8s generated metrics

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?
    How to alert on metrics with a high cardinality in prometheus - Stack Overflow