feat: add dynamic target support - #1336
Conversation
fcb9899 to
50da951
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1336 +/- ##
==========================================
- Coverage 70.88% 65.36% -5.53%
==========================================
Files 28 30 +2
Lines 3569 2616 -953
==========================================
- Hits 2530 1710 -820
+ Misses 904 746 -158
- Partials 135 160 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @ademidoff @maxkondr, the PR has been updated with the latest main. Could you please take another look when you have time? Thanks! |
|
Thanks for the contribution, and for splitting the target string validation out so carefully — rejecting credentials, paths and query params in A few notes from reading through it. 1. The note on connection reuse overstates what the cache does
The cache in What the cache genuinely buys is that it makes the pooled path reachable for dynamic targets at all: I have filed #1346 for the underlying reconnect-per-scrape default; that is pre-existing and explicitly not something this PR needs to solve. 2. The handler cache is unbounded // ponytail: service-discovery targets are stable; add bounded eviction only if target churn becomes measurable.
handlers := make(map[string]http.Handler)The reasoning holds for memory when pooling is off. But combined with Given 3. Stray comment marker The 4. Heads-up on a likely conflict
Whichever of the two lands second will need a small rebase around |
|
Thanks for the detailed review. Understood. I’ll wait for the fix for #1345 and rebase after it lands. I’ll then update the PR description, replace the unbounded handler cache with a bounded cache that disconnects evicted exporters, and remove the Thanks for pointing these out. |
Summary
/probeendpoint for MongoDB targets supplied at scrape time--config.fileflagTesting
make formatgo test -tags gssapi -count=1 . -run '^Test(LoadAuthConfig|LoadAuthConfigRejectsInvalidModule|BuildDynamicURI|ResolveAuthModule|ValidateTargetConfiguration|DynamicTargetFactoryRejectsUnknownModule|RedactMongoURI)$'go test -tags gssapi -count=1 ./exporter -run '^Test(DynamicTarget|DynamicTargetValidation|DynamicOnlyServer|ServerRequiresStaticOrDynamicTarget)$'go build .go run .github/check-license.goThe full integration suite requires the repository's MongoDB Docker sandbox; GitHub Actions runs that matrix.
Reviewer notes
The dynamic exporter handlers are cached by auth module and target so repeated Prometheus scrapes reuse MongoDB clients.