From c08a3abf838c4bbb993fc3530b9fa0540c632cde Mon Sep 17 00:00:00 2001 From: mountain Date: Thu, 15 Feb 2024 12:06:20 +0900 Subject: [PATCH] =?UTF-8?q?prometheus=20metric=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metric/prometheus.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/metric/prometheus.go b/metric/prometheus.go index 9663db3..6288c67 100644 --- a/metric/prometheus.go +++ b/metric/prometheus.go @@ -112,8 +112,10 @@ func (pe *prometheusExporter) loop(ctx context.Context) { return case req := <-pe.writerChan: - if m := collector.metrics[req.key]; m != nil { - atomic.StoreUint64(m.valptr, math.Float64bits(req.val)) + if collector != nil { + if m := collector.metrics[req.key]; m != nil { + atomic.StoreUint64(m.valptr, math.Float64bits(req.val)) + } } case nm := <-pe.registerChan: