apiVersion: v1
kind: ConfigMap
metadata:
  name: loki-ha-alerting-rules
  namespace: observability
  labels:
    loki_rule: "true"
data:
  # placeholder for loki alerting rules, the log alerting rules are maintained in runbooks
  loki-ha-alerting-rules.yaml: |-
    groups:
      - name: vmagent
        rules:
        - alert: VMAgentCoreDNSLookupFailed
          expr: |
            sum(count_over_time({cluster_env="prod",container="victoria-metrics-agent", namespace=~"monitoring|tidb.*",tenant_id!="1372813089187791289"}[2m] |~ "couldn't send.*lookup")) by (cluster_env, cluster, namespace, tenant_id, instance) > 0
          for: 5m
          labels:
            severity: critical
            component: o11y
          annotations:
            message: VMAgent failed to send blocks due to dns lookup error (instance {{`{{`}} $labels.instance {{`}}`}})
            description: 'The vmagent {{`{{`}} $labels.cluster_env {{`}}`}} {{`{{`}} $labels.cluster {{`}}`}} {{`{{`}} $labels.namespace {{`}}`}} is experiencing coredns lookup errors'
