Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PMM-12712 Small refactor.
Browse files Browse the repository at this point in the history
JiriCtvrtka committed Jan 2, 2024
1 parent 17cfccd commit 5949050
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions exporter/sharded_collector.go
Original file line number Diff line number Diff line change
@@ -55,6 +55,7 @@ func (d *shardedCollector) collect(ch chan<- prometheus.Metric) {

client := d.base.client
logger := d.base.logger
prefix := "sharded collection chunks"

databaseNames, err := client.ListDatabaseNames(d.ctx, bson.D{})
if err != nil {
@@ -82,7 +83,6 @@ func (d *shardedCollector) collect(ch chan<- prometheus.Metric) {
continue
}

prefix := "sharded collection chunks"
labels := make(map[string]string)
labels["database"] = database
labels["collection"] = strings.Replace(rowID, fmt.Sprintf("%s.", database), "", 1)
@@ -106,8 +106,7 @@ func (d *shardedCollector) collect(ch chan<- prometheus.Metric) {
if chunks, ok = c["nChunks"].(int32); !ok {
continue
}
m := primitive.M{"count": chunks}
for _, metric := range makeMetrics(prefix, m, labels, d.compatible) {
for _, metric := range makeMetrics(prefix, primitive.M{"count": chunks}, labels, d.compatible) {
ch <- metric
}
}

0 comments on commit 5949050

Please sign in to comment.