-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix inconsistent-label-cardinality for prometheus metrics: nginx_ingress_controller_requests #8225
fix inconsistent-label-cardinality for prometheus metrics: nginx_ingress_controller_requests #8225
Conversation
if c, ok := metric.(*prometheus.CounterVec); ok { | ||
if removed := c.Delete(labels); !removed { | ||
klog.V(2).InfoS("metric not removed", "name", metricName, "ingress", ingKey, "labels", labels) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally during unit-testing, i also discovered that nginx_ingress_controller_requests
would not get removed/deleted in the unit-test (by the call of sc.RemoveMetrics(...)
) due to prometheus.CounterVec
was missing from here.
"host": stats.Host, | ||
"method": stats.Method, | ||
"path": stats.Path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these were the missing labels that caused the inconsistent label cardinality
@@ -217,6 +217,7 @@ func NewSocketCollector(pod, namespace, class string, metricsPerHost bool, bucke | |||
} | |||
|
|||
sc.metricMapping = map[string]interface{}{ | |||
prometheus.BuildFQName(PrometheusNamespace, "", "requests"): sc.requests, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally during unit-testing, i also discovered that requests
was missing from here (this was the only one metric that was missing the mapping).
for prometheus metrics: nginx_ingress_controller_requests
fb6b142
to
9c6944e
Compare
@ekovacs: This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Welcome @ekovacs! |
Hi @ekovacs. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/check-cla |
/assign @ElvinEfendi |
/assign @rikatz |
/ok-to-test |
good catch @ekovacs |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ekovacs, rikatz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…ess_controller_requests (kubernetes#8225) * fix inconsistent-label-cardinality for prometheus metrics: nginx_ingress_controller_requests * add host to collectorLabels only if metricsPerHost is true
What this PR does / why we need it:
it fixes a bug:
the bug prevents the collection of metrics:
nginx_ingress_controller_requests
#8224
Types of changes
Which issue/s this PR fixes
fixes #8224
How Has This Been Tested?
added unit test which failed without this fix, and passes with this fix in place.
Checklist: