From f4f3a3110c7e6dabe0a6467e5ab7a84cb29bbd7d Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Sat, 1 Dec 2018 00:13:53 +0800 Subject: [PATCH] Only log errors when there actually was an error --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 56cfe28..2e5a106 100644 --- a/main.go +++ b/main.go @@ -44,7 +44,9 @@ func main() { val = 1 } ch <- prometheus.MustNewConstMetric(rpcFailedDesc, prometheus.GaugeValue, val, rpc) - level.Warn(logger).Log("msg", "error querying RPC", "rpc", rpc, "err", err) + if err != nil { + level.Warn(logger).Log("msg", "error querying RPC", "rpc", rpc, "err", err) + } } reg := prometheus.NewRegistry()