Skip to content

Conversation

LinPr
Copy link

@LinPr LinPr commented Aug 13, 2025

Refer to this issue: #1144

Changes:

  1. skip the non-exist namespaces when there are multiple mongo instance metrics to scrape
  2. by the way the listAllCollections(ctx, client, collections, nil, true) need to pass collections as the third parameter to reduce the databases and collections to list, wihich can improve the performance

@LinPr LinPr requested a review from a team as a code owner August 13, 2025 12:46
@LinPr LinPr requested review from BupycHuk and JiriCtvrtka and removed request for a team August 13, 2025 12:46
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.09%. Comparing base (dc46ed5) to head (b70a24b).
⚠️ Report is 126 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (dc46ed5) and HEAD (b70a24b). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (dc46ed5) HEAD (b70a24b)
agent 10 8
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     
Flag Coverage Δ
agent 65.09% <100.00%> (-5.80%) ⬇️

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.

@@ -183,7 +183,7 @@ func checkNamespacesForViews(ctx context.Context, client *mongo.Client, collecti
}

if _, ok := namespaces[collection]; !ok {
return nil, errors.Errorf("namespace %s is a view and cannot be used for collstats/indexstats", collection)
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's log that we are skipping this collection

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good idea

Comment on lines 202 to 204
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to also update the test name. also, testdb01.view01 is a view, so we should only expect testdb01.col01 in this list.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. very good, I agree with you

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.

2 participants