Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascending and descending indexes not shown in mongodb_collstats_storageStats_indexSizes_<name> #692

Open
pclaudinoo opened this issue Jul 25, 2023 · 0 comments

Comments

@pclaudinoo
Copy link

Describe the bug
After the creation of an index with a field:1 and then the same field:-1, the -1 index is not shown in mongodb_collstats_storageStats_indexSizes_

When the $indextstas is run inside mongo shell, it shows the index

rsGREEN01:PRIMARY> db.MyColForExporter.aggregate( [ { $indexStats: { } } ] )
{ "name" : "foo_1", "key" : { "foo" : 1 }, "host" : "82f532a48d72:27017", "accesses" : { "ops" : NumberLong(0), "since" : ISODate("2023-07-25T10:08:32.355Z") }, "spec" : { "v" : 2, "key" : { "foo" : 1 }, "name" : "foo_1" } }
{ "name" : "_id_", "key" : { "_id" : 1 }, "host" : "82f532a48d72:27017", "accesses" : { "ops" : NumberLong(0), "since" : ISODate("2023-07-24T15:20:44.631Z") }, "spec" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_" } }
{ "name" : "foo_-1", "key" : { "foo" : -1 }, "host" : "82f532a48d72:27017", "accesses" : { "ops" : NumberLong(5), "since" : ISODate("2023-07-25T08:46:08.858Z") }, "spec" : { "v" : 2, "key" : { "foo" : -1 }, "name" : "foo_-1" } }

But the metric does not exist

[root@7b9f50bfa3f4 srv]# grep -i indexsize metrics.txt
# HELP mongodb_collstats_storageStats_indexSizes_foo_1 collstats.storageStats.indexSizes.
# TYPE mongodb_collstats_storageStats_indexSizes_foo_1 untyped
mongodb_collstats_storageStats_indexSizes_foo_1{cl_id="64b019a12951c4fc833ca7db",cl_role="",collection="MyColForExporter",database="myDBforExporter",rs_nm="rsGREEN01",rs_state="2"} 36864
# HELP mongodb_collstats_storageStats_indexSizes_id collstats.storageStats.indexSizes.
# TYPE mongodb_collstats_storageStats_indexSizes_id untyped
mongodb_collstats_storageStats_indexSizes_id{cl_id="64b019a12951c4fc833ca7db",cl_role="",collection="MyColForExporter",database="myDBforExporter",rs_nm="rsGREEN01",rs_state="2"} 36864
mongodb_collstats_storageStats_indexSizes_id{cl_id="64b019a12951c4fc833ca7db",cl_role="",collection="myCol",database="myDB",rs_nm="rsGREEN01",rs_state="2"} 36864
# HELP mongodb_collstats_storageStats_totalIndexSize collstats.storageStats.
# TYPE mongodb_collstats_storageStats_totalIndexSize untyped
mongodb_collstats_storageStats_totalIndexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",collection="MyColForExporter",database="myDBforExporter",rs_nm="rsGREEN01",rs_state="2"} 94208
mongodb_collstats_storageStats_totalIndexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",collection="myCol",database="myDB",rs_nm="rsGREEN01",rs_state="2"} 36864
# HELP mongodb_dbstats_indexSize dbstats.
# TYPE mongodb_dbstats_indexSize untyped
mongodb_dbstats_indexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",database="admin",rs_nm="rsGREEN01",rs_state="2"} 147456
mongodb_dbstats_indexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",database="config",rs_nm="rsGREEN01",rs_state="2"} 45056
mongodb_dbstats_indexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",database="local",rs_nm="rsGREEN01",rs_state="2"} 159744
mongodb_dbstats_indexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",database="myDB",rs_nm="rsGREEN01",rs_state="2"} 36864
mongodb_dbstats_indexSize{cl_id="64b019a12951c4fc833ca7db",cl_role="",database="myDBforExporter",rs_nm="rsGREEN01",rs_state="2"} 94208

To Reproduce
Steps to reproduce the behavior:

  1. Create the index: db.MyColForExporter.createIndex({"foo":1})
  2. Create an homonimous index with descending order: db.MyColForExporter.createIndex({"foo":-1})
  3. Compare data exhibited in $indexStats and metrics generated by the exporter

Expected behavior
To have one metric mongodb_collstats_storageStats_indexSizes_foo_1 and another mongodb_collstats_storageStats_indexSizes_foo_-1

Logs
NA

Environment

  • OS: Centos 7.9
  • Environment: Docker
  • MongoDB version: Percona Server for MongoDB shell version v4.4.9-10
  • Exporter version: v0.39.0

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant