Skip to content

mongodb_connPoolStats_replicaSets_{replName}_{childM}_{childMX} collect failed #1125

@naughtyGitCat

Description

@naughtyGitCat

Describe the bug

mongodb_connPoolStats_replicaSets_{replName}_{childM}_{childMX} collect failed, in diagnostic_data_collector.go, processing slice document, the mongodb_connPoolStats_replicaSets_{replName} metrics have slice documents, and does not have a builtin distinct name for label name

                                "XX_COMMON_V36_SHARD_02" : {
                                        "hosts" : [
                                                {
                                                        "addr" : "1.1.1.1:36002",
                                                        "ok" : true,
                                                        "ismaster" : true,
                                                        "hidden" : false,
                                                        "secondary" : false,
                                                        "pingTimeMillis" : 0
                                                },
                                                {
                                                        "addr" : "2.2.2.2:36002",
                                                        "ok" : true,
                                                        "ismaster" : false,
                                                        "hidden" : false,
                                                        "secondary" : true,
                                                        "pingTimeMillis" : 0
                                                }
                                        ]
                                }

To Reproduce
Steps to reproduce the behavior:
0. init shard cluster with configsvr(more than 2 replset instance), shards (more than 2 replset instance)

  1. ./mongodb_exporter--collector.diagnosticdata
  2. curl ip:port/metrics
  3. watch console logs

Expected behavior
no error

Logs

time=2025-08-04T06:38:06.940Z level=ERROR source=http_error_logger.go:47 msg="error gathering metrics:" error="[from Gatherer #2] collected metric \"mongodb_connPoolStats_replicaSets_XX_COMMON_V36_CONFIGSVR_hosts_ismaster\" { label:{name:\"cl_id\" value:\"67be8886887b188888d29564\"} label:{name:\"cl_role\" value:\"mongos\"} untyped:{value:0}} was collected before with the same name and label values" total_errors=25 error_no=17
time=2025-08-04T06:49:06.932Z level=ERROR source=http_error_logger.go:53 msg="error gathering metrics:25 error(s) occurred:\n* [from Gatherer #2] collected metric \"mongodb_connPoolStats_replicaSets_XX_COMMON_V36_SHARD_01_hosts_ok\" { label:{name:\"cl_id\" value:\"67be8886887b188888d29564\"} label:{name:\"cl_role\" value:\"mongos\"} untyped:{value:1}} was collected before with the same name and label values\n*

Environment

  • OS debian11
  • environment meta server
  • MongoDB3.6.9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions