-
Notifications
You must be signed in to change notification settings - Fork 441
PMM-14141 #1107
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
base: main
Are you sure you want to change the base?
PMM-14141 #1107
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1107 +/- ##
==========================================
- Coverage 70.88% 65.29% -5.60%
==========================================
Files 28 29 +1
Lines 3569 3080 -489
==========================================
- Hits 2530 2011 -519
- Misses 904 929 +25
- Partials 135 140 +5
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:
|
Hi, can you please address linter comments? |
The previous implementation expected this header to be an integer, but vmagent may send it as a float. This caused incorrect handling in `mongodb_exporter`. Updated to support float values.
The exporter was returning cached MongoDB connections without validating their health. This meant that if a connection had become unhealthy, subsequent operations would fail after a delay (serverSelectionTimeout etc), causing the entire request to be slower than it should be. This commit adds `Ping` check before returning a cached client.
Done. |
Co-authored-by: Alex Demidoff <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the MongoDB client reconnection logic and refines the Prometheus scrape timeout parsing in the HTTP handler.
- Adds a
Ping
check before reusing an existing MongoDB client ingetClient
. - Switches timeout header parsing from
Atoi
toParseFloat
and logs invalid values. - Updates the
WithTimeout
calculation to work with floating‐point seconds and subtracts the configured offset.
Comments suppressed due to low confidence (1)
exporter/exporter.go:309
- [nitpick] The variable name
seconds
is generic. Renaming it totimeoutSeconds
or similar would improve clarity.
seconds := 10.0
PMM-14141 (optional, if ticket reported)
Below we provide a basic checklist of things that would make it a good PR:
Once all checks pass and the code is ready for review, please add
pmm-review-exporters
team as the reviewer. That would assign people from the review team automatically. Report any issues on our Forum.