Skip to content

Commit b1d0bd4

Browse files
authored
license: fix metric cardinality panic in expiry metric (#3868)
The license expiry metric initialization incorrectly passed a description string as the second parameter to NewGauge. The method signature is NewGauge(name string, labelKeys ...string), so the description was interpreted as a label key, causing Prometheus to expect 1 label value. When Set() was called with 0 label values, it panicked with "inconsistent label cardinality: expected 1 label values but got 0". Remove the erroneous description parameter. Metric descriptions are not supported by the NewGauge API.
1 parent 9a6a684 commit b1d0bd4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

internal/license/service.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ func (s *Service) setLicense(res *service.Resources, l *RedpandaLicense) {
149149
}
150150

151151
if s.expiryMetric == nil {
152-
s.expiryMetric = res.Metrics().NewGauge("redpanda_cluster_features_enterprise_license_expiry_sec",
153-
"Seconds remaining until the enterprise license expires.",
154-
)
152+
s.expiryMetric = res.Metrics().NewGauge("redpanda_cluster_features_enterprise_license_expiry_sec")
155153
}
156154
ctx, cancel := context.WithCancel(context.Background())
157155
s.cancel = cancel

0 commit comments

Comments
 (0)