Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collstats metrics for shard cluster is incomplete #824

Open
abelite-fang opened this issue Mar 20, 2024 · 5 comments
Open

collstats metrics for shard cluster is incomplete #824

abelite-fang opened this issue Mar 20, 2024 · 5 comments

Comments

@abelite-fang
Copy link

Describe the bug
We are using mongodb_exporter on our shard cluster via SRV record, the collstats metrics like mongodb_collstats_storageStats_count{} return single shard count, and there is no label to identify which shard it is.

To Reproduce
Steps to reproduce the behavior:

  1. Parameters:
serviceMonitor:
  enabled: true
  interval: 10s
  scrapeTimeout: 9s
  additionalLabels:
    release: prometheus-operator
  metricRelabelings:
    - targetLabel: cl_name
      replacement: core

existingSecret:
  name: "prometheus-mongodb-exporter"
  key: "mongodb-uri"

extraArgs:
  - --collector.indexstats
  - --collector.collstats
  - --collector.collstats-limit=0
  - --collect-all=true
  - --discovering-mode=true
  - --no-mongodb.direct-connect
  1. connection string set to SRV record, and designate collection label to a sharded collection, exporter will only return single shard collstats.

Expected behavior
Expect to have collstats (e.g. document counts, logical data size, etc.) for each shard on a sharded cluster, identify by shard name (replicaset name) or any other label.

Logs
no relevance error log.

Environment

  • environment: Kubernetes (EKS)
  • MongoDB Atlas (managed), version: 5.0.25
  • helm chart: prometheus-community/prometheus-mongodb-exporter version 3.5.0
  • image: percona/mongodb_exporter:0.40.0
@igroene
Copy link
Member

igroene commented May 30, 2024

the rs_nm label should be useful to know which shard it belongs to

@igroene igroene closed this as completed Jun 5, 2024
@steveteuber
Copy link
Contributor

Today we realized that the collstats (e.g. document counts) are just from a single shard...
So, I think this bug still exists in the current version or have I missed something?

extraArgs::
  - --web.listen-address=:9216
  - --no-mongodb.direct-connect
  - --discovering-mode
  - --collector.collstats
  - --collector.indexstats
  - --collector.shards

Environment

MongoDB Atlas Version: 7.0.14
Helm Chart: prometheus-community/prometheus-mongodb-exporter:3.8.0
Exporter Image: percona/mongodb_exporter:0.42.0

@igroene
Copy link
Member

igroene commented Oct 30, 2024

this is working as intended. The exporter collects data from a single shard. You can use aggregation functions to get the total values per cluster.

@steveteuber
Copy link
Contributor

I understand, but there is no extra label on the mongodb_collstats_storageStats_count metric to identify the shard:

# HELP mongodb_collstats_storageStats_count collstats.storageStats.
# TYPE mongodb_collstats_storageStats_count counter
mongodb_collstats_storageStats_count{cl_id="62fc834eee3dc317bcef0fed",cl_role="",collection="browseItems",database="cache"} 5.7282281e+07

In comparison, the arg --collector.shards generates the following metrics with a shard label that we would expect for the metric above:

# HELP mongodb_shards_collection_chunks_count shards collection chunks.
# TYPE mongodb_shards_collection_chunks_count counter
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-0"} 103
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-1"} 92
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-2"} 210
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-3"} 256
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-4"} 80
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-5"} 200
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-6"} 325
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-7"} 364
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-8"} 224
mongodb_shards_collection_chunks_count{collection="browseItems",database="cache",shard="atlas-100236-shard-9"} 231

@igroene
Copy link
Member

igroene commented Oct 30, 2024

you are correct. I was seeing the rs_nm label but looks like that is something that PMM-agent adds. The exporter needs to have this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants