fix(ingress): keep application identity off ingress-nginx scrape-health series

Dropping the identity in metricRelabelConfigs reaches only the scraped
samples. vmagent adds up and scrape_* with the target labels after
metric relabeling (VictoriaMetrics v1.136.0 lib/promscrape addAutoMetrics,
addRows with needRelabel=false), so those series still carried the
controller pod's identity. Dropping it from the target as well leaves
every ingress-nginx series with the label set it had before the scrape
class. The metric-stage drop stays: with honorLabels true an
exporter-supplied identity is not renamed and would otherwise survive.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
ZverGuy committed 2026-11-05 00:17:46 +07:00
1 parent 7f7496c8d3
commit dab6035a97
2 files changed
+14 -2

No files matched your search

@@ -12,7 +12,8 @@ spec:
# The series describe the Ingress objects served, in any namespace, not
# this controller, so the application identity the vmagent scrape class
# stamps from the controller pod would misattribute them; and with
# honorLabels an exporter-supplied identity would win over the class.
# honorLabels an exporter-supplied identity would win over the class. The
# target-stage drop also covers up and scrape_*, which skip metric relabeling.
- port: metrics
honorLabels: true
interval: 30s
@@ -23,6 +24,8 @@ spec:
targetLabel: node
- targetLabel: tier
replacement: cluster
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
metricRelabelConfigs:
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
@@ -53,6 +56,8 @@ spec:
targetLabel: controller
- targetLabel: tier
replacement: cluster
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
metricRelabelConfigs:
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
@@ -10,13 +10,20 @@ release:
# in whatever namespace they live (honorLabels keeps their namespace), so
# the controller's identity would misattribute them, and with honorLabels
# true an exporter-supplied identity would win over the class. Both
# endpoints drop the identity instead.
# endpoints drop the identity instead: from the target, because vmagent
# adds up and scrape_* with the target labels after metric relabeling, and
# from the scraped samples, because an exporter's copy is not renamed.
tests:
- it: drops the identity on every endpoint
asserts:
- lengthEqual:
path: spec.podMetricsEndpoints
count: 1
- contains:
path: spec.podMetricsEndpoints[0].relabelConfigs
content:
action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
- equal:
path: spec.podMetricsEndpoints[0].metricRelabelConfigs
value: