Cherry-pick #19699 to 7.x: Fix k8s scheduler compatibility issue #19723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #19699 to 7.x branch. Original message:
What does this PR do?
This PR introduces
OpSetSuffix
in order to solve a compatibility issue in Kubernetes Scheduler metricset.In older version of k8s the Prometheus metric
scheduler_pod_preemption_victims
was a Gauge but recently they changed itto a Histogram. Until now we have been mapping this Gauge metric to
scheduling.pod.preemption.victims.count
field. This makes it impossible for the module to parse Prometheus metrics from newer versions of Scheduler where this filed is a Histogram. With this PROpSetSuffix
can try to check if the value of this metric is numeric and extend it withcounter
suffix otherwise it is of Histogram type and we do nothing. This makesscheduling.pod.preemption.victims.count
filed to be actually numeric in all cases since Histograms create this filed by default and when it is a Gauge we leverage theOpSetSuffix
to do the mapping appropriately.Why is it important?
In order to preserve compatibility with old and new versions of Prometheus metrics exported by Kubernetes Scheduler.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues