Skip to content

Commit

Permalink
Export currentOP uptime query metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
tregubov-av committed Sep 13, 2023
1 parent dc16afc commit 9b84b52
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions exporter/currentop_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package exporter

import (
"context"
"fmt"
"errors"
"strconv"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 9b84b52

Please sign in to comment.