fix(monitoring): pin the scrape size rendering and sharpen the alert

The per-job limit replaces the global flag downward as well, so an
install that raised promscrape.maxScrapeSize past it through extraArgs
has to raise this value too; say so where the value is set. Pin that a
numeric value still renders as a string, which the CRD field requires,
and pin the alert severity. Name the cluster in the alert and say where
the apiserver value lives, since a guest cluster cannot set it.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
(cherry picked from commit 380c446cda)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
This commit is contained in:
IvanHunters authored and Myasnikov Daniil committed 2026-11-26 16:18:52 +00:00
1 parent 0be2b2e41c
commit 01db49d138
3 files changed
+22 -7

No files matched your search

@@ -17,9 +17,10 @@ spec:
annotations:
summary: vmagent refuses scrape responses larger than its size limit.
description: >-
vmagent {{ $labels.namespace }}/{{ $labels.pod }} dropped scrape responses that exceed
-promscrape.maxScrapeSize or the scrape's max_scrape_size. The affected targets report
up == 0, so TargetDown or KubeAPIDown may fire for a healthy target. The counter carries
no target label: find the target on the vmagent /targets page, where the last error names
the size limit, then raise max_scrape_size on that scrape (vmagent.apiserverMaxScrapeSize
for kube-apiserver).
vmagent {{ $labels.namespace }}/{{ $labels.pod }} in cluster {{ $labels.cluster }} dropped
scrape responses that exceed -promscrape.maxScrapeSize or the scrape's max_scrape_size.
The affected targets report up == 0, so TargetDown or KubeAPIDown may fire for a healthy
target. The counter carries no target label: find the target on the vmagent /targets
page, where the last error names the size limit, then raise max_scrape_size on that
scrape. For kube-apiserver on the management cluster this is the
vmagent.apiserverMaxScrapeSize value of the monitoring-agents component.
@@ -28,6 +28,15 @@ tests:
path: spec.endpoints[0].max_scrape_size
value: 512MB
- it: a byte count renders as a string, as the CRD field requires
template: templates/apiserver-scrape.yaml
set:
vmagent.apiserverMaxScrapeSize: 134217728
asserts:
- matchRegex:
path: spec.endpoints[0].max_scrape_size
pattern: ^[0-9.e+]+$
- it: an empty value falls back to the global flag
template: templates/apiserver-scrape.yaml
set:
@@ -55,3 +64,6 @@ tests:
- equal:
path: spec.groups[0].rules[0].expr
value: increase(vm_promscrape_max_scrape_size_exceeded_errors_total[10m]) > 0
- equal:
path: spec.groups[0].rules[0].labels.severity
value: warning
@@ -286,7 +286,9 @@ vmagent:
# Replaces the global promscrape.maxScrapeSize (32MB) for the kube-apiserver
# job only. Its /metrics grows with the number of CRDs and outgrows 32MB on a
# full install. vmagent buffers the whole uncompressed response even with
# streamParse, so keep this finite. An empty value falls back to the global.
# streamParse, so keep this finite. It replaces the global in both
# directions: if extraArgs raises promscrape.maxScrapeSize above this value,
# raise this one too. An empty value falls back to the global.
apiserverMaxScrapeSize: 128MB
fluent-bit: