Skip to content

PMM-15071: Add MongoDB Unused Indexes dashboard#5636

Open
fabio-silva wants to merge 18 commits into
mainfrom
cursor/mongodb-unused-indexes-dashboard-0faa
Open

PMM-15071: Add MongoDB Unused Indexes dashboard#5636
fabio-silva wants to merge 18 commits into
mainfrom
cursor/mongodb-unused-indexes-dashboard-0faa

Conversation

@fabio-silva

@fabio-silva fabio-silva commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new MongoDB Unused Indexes Grafana dashboard that surfaces indexes with zero accesses since the last mongod restart — candidates for review and possible removal.

The dashboard uses the same core metric and logic as the existing MongoDB Unused Indexes advisor check:

avg by (cluster, collection, database, key_name) (
  mongodb_indexstats_accesses_ops{node_name=~"$node_name"}
) == 0

Changes

  • New dashboard: dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json
    • Summary stats: instance uptime, unused index count, total indexes monitored
    • Table panel listing unused indexes by cluster/database/collection/index
    • Timeseries and table panels for index access activity
    • Standard MongoDB dashboard variables (environment, cluster, replication set, service, database)
    • Excludes the default _id_ index
  • Plugin registration: added to dashboards/pmm-app/src/plugin.json
  • PMM UI navigation: added under MongoDB → Unused indexes
  • Documentation: documentation/docs/reference/dashboards/dashboard-mongodb-unused-indexes.md

Requirements

The indexstats collector must be enabled on the MongoDB exporter for this dashboard to show data.

Notes

  • Index usage is recorded only on the node that executes the query; on replica sets, review all members before dropping an index.
  • Screenshots can be added in a follow-up once validated against a live PMM environment.

Screenshots

Screenshot 2026-07-13 at 12 17 35 Screenshot 2026-07-13 at 12 17 40 Screenshot 2026-07-13 at 12 17 45

Ticket number: PMM-15071

Introduce a new Grafana dashboard under MongoDB dashboards that surfaces
indexes with zero accesses since the last mongod restart using the
mongodb_indexstats_accesses_ops metric.

- Add MongoDB_Unused_Indexes.json with summary stats, unused index table,
  and index access activity panels
- Register dashboard in pmm-app plugin.json
- Add PMM UI navigation entry under MongoDB
- Add dashboard reference documentation

Co-authored-by: Fábio Silva <fabio-silva@users.noreply.github.com>
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5636      +/-   ##
==========================================
+ Coverage   43.59%   43.88%   +0.28%     
==========================================
  Files         415      545     +130     
  Lines       43134    44426    +1292     
  Branches        0      591     +591     
==========================================
+ Hits        18804    19495     +691     
- Misses      22454    23099     +645     
+ Partials     1876     1832      -44     
Flag Coverage Δ
admin 34.96% <ø> (+0.17%) ⬆️
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.

@fabio-silva
fabio-silva requested a review from igroene July 13, 2026 11:17
@fabio-silva
fabio-silva marked this pull request as ready for review July 13, 2026 11:30
@fabio-silva
fabio-silva requested review from a team and Nailya as code owners July 13, 2026 11:30
@fabio-silva
fabio-silva requested review from matejkubinec and mattiasimonato and removed request for a team July 13, 2026 11:30
@fabio-silva fabio-silva changed the title Add MongoDB Unused Indexes dashboard PMM-15071: Add MongoDB Unused Indexes dashboard Jul 13, 2026
@fabio-silva
fabio-silva requested a review from Copilot July 13, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Grafana dashboard to help identify MongoDB indexes with zero accesses since the last mongod restart, and wires it into PMM UI navigation, the dashboards plugin bundle, and the documentation site.

Changes:

  • Introduces the MongoDB Unused Indexes dashboard (panels + variables + PromQL) based on mongodb_indexstats_accesses_ops.
  • Registers the dashboard in the Grafana plugin bundle and adds a MongoDB navigation entry in PMM UI.
  • Adds a new dashboard documentation page and links it in MkDocs navigation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
ui/apps/pmm/src/contexts/navigation/navigation.constants.ts Adds a MongoDB navigation item pointing to the new dashboard.
dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json New Grafana dashboard definition (panels, variables, queries).
dashboards/pmm-app/src/plugin.json Registers the new dashboard so it’s shipped with the PMM Grafana plugin.
dashboards/README.md Updates featured dashboards list to include the new dashboard.
documentation/docs/reference/dashboards/dashboard-mongodb-unused-indexes.md Adds documentation for the new dashboard.
documentation/mkdocs-base.yml Adds the new doc page to the MkDocs nav tree.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json
Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread documentation/docs/reference/dashboards/dashboard-mongodb-unused-indexes.md Outdated
fabio-silva and others added 3 commits July 13, 2026 13:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ademidoff
ademidoff temporarily deployed to cursor/mongodb-unused-indexes-dashboard-0faa - pmm-doc-3 PR #5636 July 13, 2026 12:34 — with Render Destroyed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Comment thread documentation/docs/reference/dashboards/dashboard-mongodb-unused-indexes.md Outdated
fabio-silva and others added 2 commits July 13, 2026 13:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread dashboards/dashboards/MongoDB/MongoDB_Unused_Indexes.json Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants