Fix: Skip the non-exist namespaces when there are multiple mongo instance metrics to scrape#1146
Fix: Skip the non-exist namespaces when there are multiple mongo instance metrics to scrape#1146LinPr wants to merge 6 commits intopercona:mainfrom
Conversation
…ance metrics to scrape Signed-off-by: LinPr <314573849@qq.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #1146 +/- ##
==========================================
- Coverage 70.88% 65.09% -5.80%
==========================================
Files 28 29 +1
Lines 3569 3091 -478
==========================================
- Hits 2530 2012 -518
- Misses 904 939 +35
- 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:
|
|
|
||
| if _, ok := namespaces[collection]; !ok { | ||
| return nil, errors.Errorf("namespace %s is a view and cannot be used for collstats/indexstats", collection) | ||
| continue |
There was a problem hiding this comment.
let's log that we are skipping this collection
There was a problem hiding this comment.
Here's a snippet to consider dropping in:
if logger != nil {
logger.Warn("Skipping namespace because it is a view or does not exist", "namespace", collection)
}
continue
exporter/common_test.go
Outdated
| filtered, err := checkNamespacesForViews(ctx, client, []string{"testdb01.col01", "testdb01.system.views", "testdb01.view01"}) | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, []string{"testdb01.col01", "testdb01.system.views"}, filtered) |
There was a problem hiding this comment.
we need to also update the test name. also, testdb01.view01 is a view, so we should only expect testdb01.col01 in this list.
There was a problem hiding this comment.
yeah. very good, I agree with you
…ance metrics to scrape Signed-off-by: LinPr <314573849@qq.com>
Refer to this issue: #1144
Changes: