@cryptotaxi247 / netdata-1 / commits / ff866e463

go.d k8state: skip jobs/cronjobs Pods (#18028)

Ilya Mashchenko committed Jun 27, 2024 at 19:42 UTC ff866e463f4031ca87b6369187375aa999daed8c
2 files changed +7 -7
src/go/collectors/go.d.plugin/modules/k8s_state/collect.go
+7
@@ -68,6 +68,13 @@ func (ks *KubeState) collectKubeState(mx map[string]int64) {
68 func (ks *KubeState) collectPodsState(mx map[string]int64) {
69 now := time.Now()
70 for _, ps := range ks.state.pods {
71 + // Skip cronjobs (each of them is a unique container because name contains hash)
72 + // to avoid overwhelming Netdata with high cardinality metrics.
73 + // Related issue https://github.com/netdata/netdata/issues/16412
74 + if ps.controllerKind == "Job" {
75 + continue
76 + }
77 +
78 if ps.deleted {
79 delete(ks.state.pods, podSource(ps.namespace, ps.name))
80 ks.removePodCharts(ps)
src/go/collectors/go.d.plugin/modules/k8s_state/update_pod_state.go
-7
@@ -149,13 +149,6 @@ func (ks *KubeState) updatePodState(r resource) {
149 }
150 }
151
152 -func max(a, b int64) int64 {
153 - if a < b {
154 - return b
155 - }
156 - return a
157 -}
158 -
152 func extractContainerID(id string) string {
153 // docker://d98...
154 if i := strings.LastIndexByte(id, '/'); i != -1 {