Skip to content

Commit 05fc36b

Browse files
committed
fix(quota): update metric collection to use limit label for ResourceQuota
Signed-off-by: Paul Tsai <paul_tsai@phison.com>
1 parent f8790de commit 05fc36b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/scheduler/metrics.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,22 @@ func (cc ClusterManagerCollector) Collect(ch chan<- prometheus.Metric) {
298298
)
299299
for ns, val := range sher.GetQuotaManager().GetResourceQuota() {
300300
for quotaname, q := range *val {
301+
limitLabel := "unlimited"
302+
if q.LimitSet {
303+
limitLabel = fmt.Sprint(q.Limit)
304+
}
301305
ch <- prometheus.MustNewConstMetric(
302306
quotaUsedDesc,
303307
prometheus.GaugeValue,
304308
float64(q.Used),
305-
ns, quotaname, fmt.Sprint(q.Limit),
309+
ns, quotaname, limitLabel,
306310
)
307311
if legacy {
308312
ch <- prometheus.MustNewConstMetric(
309313
legacyQuotaUsed,
310314
prometheus.GaugeValue,
311315
float64(q.Used),
312-
ns, quotaname, fmt.Sprint(q.Limit),
316+
ns, quotaname, limitLabel,
313317
)
314318
}
315319
}

0 commit comments

Comments
 (0)