Skip to content

fix(dashboards): source Router Summary cluster variable from mongos metric (PMM-15174)#5608

Merged
theTibi merged 3 commits into
mainfrom
PMM-15174-fix-router-cluster-var
Jul 13, 2026
Merged

fix(dashboards): source Router Summary cluster variable from mongos metric (PMM-15174)#5608
theTibi merged 3 commits into
mainfrom
PMM-15174-fix-router-cluster-var

Conversation

@theTibi

@theTibi theTibi commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bug: In the MongoDB Router Summary dashboard, the Cluster template variable shows wrong values (or nothing), leaving the router panels empty.
  • Root cause: The cluster variable was populated from the mongod/replset metric mongodb_mongod_replset_my_state, while the dashboard's other cascading variables (service_name, node_name) and panel filters are all scoped to the mongos router metric mongodb_mongos_sharding_shards_total. The cluster label values on the mongod (shard) services do not necessarily match those on the mongos (router) services, so the dropdown was populated from the wrong metric.
  • Fix: Source the cluster variable from mongodb_mongos_sharding_shards_total (both definition and query), matching service_name/node_name and listing exactly the clusters that have a mongos router — as requested in the ticket.
- label_values(mongodb_mongod_replset_my_state{environment=~"$environment"},cluster)
+ label_values(mongodb_mongos_sharding_shards_total{environment=~"$environment"},cluster)

Ticket

Test plan

  • python3 dashboards/misc/cleanup-dash.py --check-only dashboards/dashboards/MongoDB/MongoDB_Router_Summary.json passes (no formatting changes)
  • JSON is valid
  • On a PMM Server monitoring a sharded MongoDB with mongos routers: the Cluster dropdown lists the sharded cluster(s) with routers, and selecting one populates service_name/node_name and renders data in the router panels
  • Cluster list is consistent with the MongoDB Sharded Cluster Summary dashboard
  • pmm-submodules (FB) PR: PMM-15174-fix-router-cluster-var (FB) Percona-Lab/pmm-submodules#4462

Notes

  • Out of scope: the Routers panel also queries the mongod metric mongodb_mongod_replset_my_state; this PR intentionally changes only the cluster variable per the ticket. A follow-up can address the panel if needed.

…etric (PMM-15174)

The cluster template variable in the MongoDB Router Summary dashboard was
populated from the mongod/replset metric mongodb_mongod_replset_my_state,
while the dashboard's other cascading variables (service_name, node_name)
and panel filters are all scoped to the mongos router metric
mongodb_mongos_sharding_shards_total. The cluster label values on the
mongod (shard) services do not necessarily match those on the mongos
(router) services, so the Cluster dropdown showed wrong values or nothing
and the router panels stayed empty.

Source the cluster variable from mongodb_mongos_sharding_shards_total so it
is consistent with service_name/node_name and lists exactly the clusters
that have a mongos router.

Signed-off-by: theTibi <tkorocz@gmail.com>
@theTibi
theTibi requested review from a team and Nailya as code owners July 7, 2026 09:52
@theTibi
theTibi requested review from fabio-silva and mattiasimonato and removed request for a team July 7, 2026 09:52
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.78%. Comparing base (31318c7) to head (56f866d).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5608      +/-   ##
==========================================
+ Coverage   43.59%   43.78%   +0.19%     
==========================================
  Files         415      545     +130     
  Lines       43134    45087    +1953     
  Branches        0      591     +591     
==========================================
+ Hits        18804    19742     +938     
- Misses      22454    23407     +953     
- Partials     1876     1938      +62     
Flag Coverage Δ
admin 34.78% <ø> (ø)
unittests 41.29% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ademidoff
ademidoff temporarily deployed to PMM-15174-fix-router-cluster-var - pmm-doc-3 PR #5608 July 7, 2026 14:13 — with Render Destroyed
@theTibi
theTibi enabled auto-merge (squash) July 13, 2026 08:54
@theTibi
theTibi merged commit 8899907 into main Jul 13, 2026
14 checks passed
@theTibi
theTibi deleted the PMM-15174-fix-router-cluster-var branch July 13, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants