MongoDB exporter `IndexStatsCollections` is assigned values from wrong flag

Description

Expected results:

  • Assigning values using `mongodb.collstats-colls` flag only enables collection stats for the listed collections.

  • Assigning values using `mongodb.indexstats-colls` flag only enables index stats for the listed collections.

Actual results:

  • Assigning values using `mongodb.collstats-colls` flag enables both collection and index stats.

  • Assigning values using `mongodb.indexstats-colls` flag has no effect.

 

IndexStatsCollections is being assigned the values from the `mongodb.collstats-colls` flag. 

Appears to be a bug here: https://github.com/percona/mongodb_exporter/blob/be2da0287d612e01e85e02b2ee920f0f2906407a/main.go#L98

 

HOW TO TEST:

  1. Create a collection in MongoDB.

  2. Add an index to the collection. 

  3. Manually start the exporter specifying the collection.index

  4.  Browse to the exporter's URL and you must see stats regarding the index usage.

  5. CollStats shouldn't be enabled.

Example in mongo shell

Then if you start the exporter like this: 

/mongodb_exporter --mongodb.uri=mongodb://127.0.0.1:17001/admin --mongodb.indexstats-colls=test.c1

and browse to http://localhost:9216/metrics
you will see something like this:  (search for test.c1, the db.collection name)

How to test

None

How to document

None

Smart Checklist

Activity

Show:

Roma Novikov March 8, 2021 at 3:27 PM

The issue wasn't released and will be in  

Roma Novikov March 5, 2021 at 8:49 PM

because of reopening it and adding to the sprint for the visibility

Zoriana Stefanyshyn February 22, 2021 at 7:41 PM

Tested on perconalab/pmm-server-fb:PR-1533-13b4d6c. Fixed.

Carlos Salguero February 18, 2021 at 3:38 PM

Carlos Salguero February 18, 2021 at 2:47 PM

The release-0.20.0 branch is based on v0.20.0
This command returns nothing (no diff): git diff release-0.20.1...v0.20.0

 

Done

Details

Assignee

Reporter

Priority

Components

Needs QA

Yes

Fix versions

Story Points

Sprint

Smart Checklist

Created February 4, 2021 at 8:55 PM
Updated November 13, 2024 at 9:46 AM
Resolved March 9, 2021 at 7:40 PM