Skip to content

Commit

Permalink
feat(metrics): restore k8s.replicaset.* metrics by keeping only non-z…
Browse files Browse the repository at this point in the history
…ero values

This removes noisy replicaset metrics while keeping the ones that
actually have value. By default, Kubernetes keeps a history of 10
replicasets for each deployment, collecting metrics about all of them
leads to a lot of metric datapoints with no value. Removing zero-value
datapoints makes sure the backend knows about the actual active
replicaset (with desired > 0).
  • Loading branch information
mmanciop authored and basti1302 committed Feb 3, 2025
1 parent 8bfaedd commit b90e311
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ processors:
- {{ .NamespaceOttlFilter }}
{{- end }}

# Remove noisy replicaset metrics (by default, Kubernetes keeps a history of 10 replicasets for each deployment,
# collecting metrics about all of them leads to a lot of metrics with no value). Removing zero-value datapoints
# makes sure the backend knows about the actual active replicaset (with desired > 0).
filter/drop-replicaset-metrics-zero-value:
error_mode: ignore
metrics:
datapoint:
- metric.name == "k8s.replicaset.available" and value_int == 0
- metric.name == "k8s.replicaset.desired" and value_int == 0

memory_limiter:
check_interval: 5s
limit_percentage: 80
Expand All @@ -90,10 +100,6 @@ receivers:
enabled: false
k8s.namespace.phase:
enabled: false
k8s.replicaset.desired:
enabled: false
k8s.replicaset.available:
enabled: false

service:
extensions:
Expand All @@ -112,6 +118,7 @@ service:
{{- if .NamespaceOttlFilter }}
- filter/metrics_only_monitored_namespaces
{{- end }}
- filter/drop-replicaset-metrics-zero-value
- memory_limiter
- batch
exporters:
Expand Down

0 comments on commit b90e311

Please sign in to comment.