From 9b84b52b3c36309f38de0c577df351a9e76535a1 Mon Sep 17 00:00:00 2001 From: Andrey Tregubov <55836868+tregubov-av@users.noreply.github.com> Date: Wed, 13 Sep 2023 18:28:12 +0300 Subject: [PATCH] Export currentOP uptime query metrics --- exporter/currentop_collector.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exporter/currentop_collector.go b/exporter/currentop_collector.go index ed37a411a..8db6211de 100644 --- a/exporter/currentop_collector.go +++ b/exporter/currentop_collector.go @@ -17,7 +17,7 @@ package exporter import ( "context" - "fmt" + "errors" "strconv" "github.com/prometheus/client_golang/prometheus" @@ -97,33 +97,33 @@ func (d *currentopCollector) collect(ch chan<- prometheus.Metric) { bsonMapElement, ok := bsonMap.(primitive.M) if !ok { - logger.Errorf("Invalid type primitive.M assertion for bsonMap: %t", ok) + logger.Errorf("Invalid type primitive.M assertion for bsonMap: %T", bsonMapElement) break } opid, ok := bsonMapElement["opid"].(int32) if !ok { - logger.Errorf("Invalid type int32 assertion for 'opid': %t", ok) + logger.Errorf("Invalid type int32 assertion for 'opid': %T", bsonMapElement) break } namespace, ok := bsonMapElement["ns"].(string) if !ok { - logger.Errorf("Invalid type string assertion for 'ns': %t", ok) + logger.Errorf("Invalid type string assertion for 'ns': %T", bsonMapElement) break } db, collection := splitNamespace(namespace) op, ok := bsonMapElement["op"].(string) if !ok { - logger.Errorf("Invalid type string assertion for 'op': %t", ok) + logger.Errorf("Invalid type string assertion for 'op': %T", bsonMapElement) break } desc, ok := bsonMapElement["desc"].(string) if !ok { - logger.Errorf("Invalid type string assertion for 'desc': %t", ok) + logger.Errorf("Invalid type string assertion for 'desc': %T", bsonMapElement) break } microsecs_running, ok := bsonMapElement["microsecs_running"].(int64) if !ok { - logger.Errorf("Invalid type int64 assertion for 'microsecs_running': %t", ok) + logger.Errorf("Invalid type int64 assertion for 'microsecs_running': %T", bsonMapElement) break }