Skip to content

Commit

Permalink
Merge pull request #69 from frezes/feat/updateMetricDenyList
Browse files Browse the repository at this point in the history
[kube-prometheus-stack] add recording rule pod_start_time:kube_node_info
  • Loading branch information
benjaminhuo authored Jul 9, 2024
2 parents fcbecfa + 8a685c7 commit 06d2cd3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 52.2.1
version: 52.2.2
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,22 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
- expr: |-
max by (cluster, namespace, pod, pod_ip, host_ip, node) (
kube_pod_info{job="kube-state-metrics"}
* on (cluster, namespace, pod, uid) group_left ()
kube_pod_start_time{job="kube-state-metrics"}
)
* on (cluster, namespace, pod) group_left (workspace, qos_class, phase)
workspace_workload_node:kube_pod_info:
record: 'pod_start_time:kube_pod_info:'
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.whizardTelemetry }}
labels:
{{- with .Values.defaultRules.additionalRuleLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.defaultRules.additionalRuleGroupLabels.whizardTelemetry }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@
)
||| % $._config
},
{
//
record: 'pod_start_time:kube_pod_info:',
expr: |||
max by (cluster, namespace, pod, pod_ip, host_ip, node) (
kube_pod_info{%(kubeStateMetricsSelector)s}
* on (cluster, namespace, pod, uid) group_left ()
kube_pod_start_time{%(kubeStateMetricsSelector)s}
)
* on (cluster, namespace, pod) group_left (workspace, qos_class, phase)
workspace_workload_node:kube_pod_info:
||| % $._config
},
],
},
{
Expand Down
9 changes: 9 additions & 0 deletions ks-prometheus/manifests/whizard-telemetry-prometheusRule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ spec:
"(.*)"
)
record: 'node_role_ip:kube_node_info:'
- expr: |
max by (cluster, namespace, pod, pod_ip, host_ip, node) (
kube_pod_info{job="kube-state-metrics"}
* on (cluster, namespace, pod, uid) group_left ()
kube_pod_start_time{job="kube-state-metrics"}
)
* on (cluster, namespace, pod) group_left (workspace, qos_class, phase)
workspace_workload_node:kube_pod_info:
record: 'pod_start_time:kube_pod_info:'
- name: whizard-telemetry-node.rules
rules:
- expr: |
Expand Down

0 comments on commit 06d2cd3

Please sign in to comment.