prometheus metric 오류 처리

This commit is contained in:
2024-02-15 12:06:20 +09:00
parent eb3926e575
commit c08a3abf83

View File

@ -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: