
{{- $Values := (.helm).Values | default .Values }}
{{- $runbookUrl := ($Values.defaultRules).runbookUrl | default "https://runbooks.prometheus-operator.dev/runbooks" }}
{{- $clusterLabel := ($Values.global).clusterLabel | default "cluster" }}
{{- $additionalGroupByLabels := append $Values.defaultRules.additionalGroupByLabels $clusterLabel }}
{{- $groupLabels := join "," (uniq $additionalGroupByLabels) }}
{{- $grafanaAddr := include "vm-k8s-stack.grafana.addr" . }}
name: kubelet.rules
rules:
- expr: {{ printf "histogram_quantile(0.99, sum(rate(kubelet_pleg_relist_duration_seconds_bucket{job=\"kubelet\",metrics_path=\"/metrics\"}[5m])) by(%s,instance,le) * on(%s,instance) group_left(node) max(kubelet_node_name{job=\"kubelet\",metrics_path=\"/metrics\"}) by(%s,instance,node))" $groupLabels $groupLabels $groupLabels }}
  condition: true
  labels:
    quantile: "0.99"
  record: node_quantile:kubelet_pleg_relist_duration_seconds:histogram_quantile
- expr: {{ printf "histogram_quantile(0.9, sum(rate(kubelet_pleg_relist_duration_seconds_bucket{job=\"kubelet\",metrics_path=\"/metrics\"}[5m])) by(%s,instance,le) * on(%s,instance) group_left(node) max(kubelet_node_name{job=\"kubelet\",metrics_path=\"/metrics\"}) by(%s,instance,node))" $groupLabels $groupLabels $groupLabels }}
  condition: true
  labels:
    quantile: "0.9"
  record: node_quantile:kubelet_pleg_relist_duration_seconds:histogram_quantile
- expr: {{ printf "histogram_quantile(0.5, sum(rate(kubelet_pleg_relist_duration_seconds_bucket{job=\"kubelet\",metrics_path=\"/metrics\"}[5m])) by(%s,instance,le) * on(%s,instance) group_left(node) max(kubelet_node_name{job=\"kubelet\",metrics_path=\"/metrics\"}) by(%s,instance,node))" $groupLabels $groupLabels $groupLabels }}
  condition: true
  labels:
    quantile: "0.5"
  record: node_quantile:kubelet_pleg_relist_duration_seconds:histogram_quantile
condition: {{ ($Values.kubelet).enabled }}
