diff --git a/src/metrics/metrics.go b/src/metrics/metrics.go index f329cee..a7c5517 100644 --- a/src/metrics/metrics.go +++ b/src/metrics/metrics.go @@ -80,9 +80,11 @@ func (c collector) Collect(ch chan<- prometheus.Metric) { if r, err := c.inst.RecorderManager.(recorders.Manager).GetRecorder(context.Background(), id); err == nil { if status, err := r.GetStatus(); err == nil { - if value, err := strconv.ParseFloat(status["total_size"].(string), 64); err == nil { - ch <- prometheus.MustNewConstMetric(recorderTotalBytes, prometheus.CounterValue, value, - string(id), l.GetRawUrl(), info.HostName, info.RoomName) + if totalSize, ok := status["total_size"].(string); ok { + if value, err := strconv.ParseFloat(totalSize, 64); err == nil { + ch <- prometheus.MustNewConstMetric(recorderTotalBytes, prometheus.CounterValue, value, + string(id), l.GetRawUrl(), info.HostName, info.RoomName) + } } } }