[receiver/mongodbreceiver] Fix index access count error collection on a replica local database #21116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
The scraper is reporting a scraper error
Unauthorized
when trying to collect index stats when the database islocal
. This occurs even when the correct roles are used.This is for the metric
mongodb.index.access.count
which isThe number of times an index has been accessed.
. This is metric is to help monitor the amount an index has been access on user created indexes, not on internal databases such as thelocal
database. Thelocal
database in MongoDB is used for internal purpose by MongoDB which manages replication, sharding and storage and should not be used directly by users. Furthermore, the local database is invisible to replication; collections in the local database are not replicated which is causing errors when attempting to do so.Link to tracking Issue:
#21114
Testing:
Updated integration test so they are not showing no mongodb.index.access.count metric with
local
database being collected.Documentation: