Fix mongodb_connections metric for mongos instances#1151
Fix mongodb_connections metric for mongos instances#1151vtomasr5 wants to merge 8 commits intopercona:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1151 +/- ##
==========================================
- Coverage 70.88% 68.72% -2.16%
==========================================
Files 28 29 +1
Lines 3569 2440 -1129
==========================================
- Hits 2530 1677 -853
+ Misses 904 589 -315
- Partials 135 174 +39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks a lot for your contribution @vtomasr5 . If you're still up, can we add some tests for mongos instances? Maybe something similar to Additionally, you can sync this branch with current main and it should fix the duplicate metrics errors in CI. |
…nto mongodb_connections_for_mongos
…tomasr5/mongodb_exporter into mongodb_connections_for_mongos
|
Hi @vtomasr5, could you address the three lints mentioned there https://github.com/percona/mongodb_exporter/pull/1151/files#diff-442864aca9e35e7752c01f444b178deb5f245bb3af68683dbacfdf3f86a618a8? |
The getDiagnosticData command returns empty data for mongos, causing connection metrics to be missing. This adds a fallback to serverStatus when getDiagnosticData returns empty data for mongos instances.
This ensures that mongodb_connections (and mongodb_ss_connections) metrics are properly exposed for mongos routers, maintaining compatibility with monitoring dashboards and alerting rules.
May fix #916