From bacf6156c139f9f3a809017fd9156d8f698591e0 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 7 Mar 2022 19:59:32 +0100 Subject: [PATCH] metrics: Avoid crash when fetching tier metrics (#14493) Data usage does not always contain tiering info even if the data usage information is valid. Avoid a crash in that case. (e.g. the scanner scanned the namespace, the user enables tiering, prometheus scrapes the server before the scanner gets a chance to update the data usage with new tiering information) --- cmd/metrics-v2.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/metrics-v2.go b/cmd/metrics-v2.go index f6cb8167b..70ec1fc1b 100644 --- a/cmd/metrics-v2.go +++ b/cmd/metrics-v2.go @@ -1663,8 +1663,8 @@ func getClusterTierMetrics() *MetricsGroup { if err != nil { return } - // data usage has not captured any data yet. - if dui.LastUpdate.IsZero() { + // data usage has not captured any tier stats yet. + if dui.TierStats == nil { return }