Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust the promql query to support all the K8s versions
The promql expression: sum by (resource) (apiserver_longrunning_requests{pod=~".+",verb="WATCH"}) or sum by (resource) (apiserver_registered_watchers{pod=~".+",resource!=""}) queries both the new metric apiserver_longrunning_requests (>=1.23) and the old metric apiserver_registered_watchers (<=1.23) and combines them with the "or" set operator: > vector1 or vector2 results in a vector that contains all original > elements (label sets + values) of vector1 and additionally all elements > of vector2 which do not have matching label sets in vector1. The metric relabeling config in the previous commit guarantees that the label sets (resource) matches, so that the result of the query is that of the new metric if it exists, or that of the old metric if the new metric does not exist. Note that the "total" query used the "count" aggregation which was semantically not meaningful. This aspect is also fixed in this commit: the registered watchers / long running requests need to be added up to get the total value. Co-authored-by: Istvan Zoltan Ballok <[email protected]> Co-authored-by: Jeremy Rickards <[email protected]>
- Loading branch information