Skip to content

Conversation

vtomasr5
Copy link

@vtomasr5 vtomasr5 commented Aug 20, 2025

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

@vtomasr5 vtomasr5 requested a review from a team as a code owner August 20, 2025 11:40
@vtomasr5 vtomasr5 requested review from BupycHuk and JiriCtvrtka and removed request for a team August 20, 2025 11:40
@it-percona-cla
Copy link

it-percona-cla commented Aug 20, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Sep 1, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.77%. Comparing base (dc46ed5) to head (5086741).
⚠️ Report is 135 commits behind head on main.

Files with missing lines Patch % Lines
exporter/diagnostic_data_collector.go 60.00% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1151      +/-   ##
==========================================
- Coverage   70.88%   68.77%   -2.12%     
==========================================
  Files          28       29       +1     
  Lines        3569     3110     -459     
==========================================
- Hits         2530     2139     -391     
+ Misses        904      799     -105     
- Partials      135      172      +37     
Flag Coverage Δ
agent 68.77% <60.00%> (-2.12%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@idoqo
Copy link
Contributor

idoqo commented Sep 27, 2025

Thanks a lot for your contribution @vtomasr5 .

If you're still up, can we add some tests for mongos instances? Maybe something similar to TestAllDiagnosticDataCollectorMetrics but connected to the mongos instance instead - only checking for mongodb_ss_connections_* is fine.

Additionally, you can sync this branch with current main and it should fix the duplicate metrics errors in CI.

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.

mongodb_connections metric not available

4 participants