percona / mongodb_exporter

A Prometheus exporter for MongoDB including sharding, replication and storage engines
Apache License 2.0
1.15k stars 426 forks source link

PMM-12805 Collstats, indexstats iterate only over collections, not views. #790

Closed JiriCtvrtka closed 6 months ago

JiriCtvrtka commented 6 months ago

PMM-12805

FB: https://github.com/Percona-Lab/pmm-submodules/pull/3534

JiriCtvrtka commented 6 months ago

Summary after required changes:

  1. Func listCollectionsWithoutViews now returns map instead array.
  2. User's input collections will end up with error if any of provided collections is view.
  3. For autodiscovery it using only collections without views.
  4. Ivan was not sure if we need apply this fix even for indexstats. Since problem is with getting cursor for view I also applied this fix to indexstats too to prevent possible problems in future.
JiriCtvrtka commented 6 months ago

@ademidoff View could be part of namespace [database-name].[collection/view/index-name]

I did refactor (possibility to get collections with/without views) and together with this I changed naming to have it more clear. Please take a look once more.