Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion exporter/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func processSlice(prefix string, v []interface{}, commonLabels map[string]string
continue
}

// use the replicaset or server name as a label
// use the replicaset or server name or addr as a label
if name, ok := s["name"].(string); ok {
labels["member_idx"] = name
}
Expand All @@ -401,6 +401,9 @@ func processSlice(prefix string, v []interface{}, commonLabels map[string]string
if host, ok := s["host"].(string); ok {
labels["member_idx"] = host
}
if addr, ok := s["addr"].(string); ok {
labels["member_addr"] = addr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to reuse member_idx?

}

metrics = append(metrics, makeMetrics(prefix, s, labels, compatibleMode)...)
}
Expand Down
59 changes: 59 additions & 0 deletions exporter/testdata/get_diagnostic_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,65 @@
"uri": "statistics:"
}
},
"connPoolStats" : {
"start" : "2025-08-04T07:10:00.002Z",
"numClientConnections" : 24,
"numAScopedConnections" : 0,
"totalInUse" : 0,
"totalAvailable" : 156,
"totalCreated" : 143694,
"totalRefreshing" : 0,
"replicaSets" : {
"shard_001" : {
"hosts" : [
{
"addr" : "1.1.1.1:36001",
"ok" : true,
"ismaster" : true,
"hidden" : false,
"secondary" : false,
"pingTimeMillis" : 0
},
{
"addr" : "2.2.2.2:36001",
"ok" : true,
"ismaster" : false,
"hidden" : false,
"secondary" : true,
"pingTimeMillis" : 0
}
]
},
"configsvr" : {
"hosts" : [
{
"addr" : "3.3.3.3:27001",
"ok" : true,
"ismaster" : true,
"hidden" : false,
"secondary" : false,
"pingTimeMillis" : 0
},
{
"addr" : "4.4.4.4:27001",
"ok" : true,
"ismaster" : false,
"hidden" : false,
"secondary" : true,
"pingTimeMillis" : 0
},
{
"addr" : "5.5.5.5:27001",
"ok" : true,
"ismaster" : false,
"hidden" : false,
"secondary" : true,
"pingTimeMillis" : 0
}
]
}
}
},
"start": "2020-09-10T14:39:52-03:00",
"systemMetrics": {
"cpu": {
Expand Down