Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
2.26.0
-
None
-
1
-
Yes
-
Yes
-
Yes
-
C/S Core
Description
Current scenario:
When querying what metrics can we get from this mongodb_exporter by using "curl http://pmm:[email protected]:<port>/metrics" we get the following error if there is a default ascending and descending index on collection.
'curl: (52) Empty reply from server' message.'
Test case:
Either pmm-admin and pmm-server on 2.26:
shell> pmm-admin --version ProjectName: pmm-admin Version: 2.26.0 PMMVersion: 2.26.0 Timestamp: 2022-02-03 14:03:35 (UTC) FullCommit: ae906c7ade001878ba229a3452abc7ea8648fb97
shell> docker exec -it pmm-server curl -ku admin:admin https://localhost/v1/version { "version": "2.26.0", "server": { "version": "2.26.0", "full_version": "2.26.0-17.2202021129.6914083.el7", "timestamp": "2022-02-02T11:30:45Z" },
1. Added the Mongodb service using the following parameters:
shell> pmm-admin add mongodb --username=admin --password=sekret --tls-skip-verify --service-name=mongodb1-db --host=localhost --port=4410 --cluster=DES02 --replication-set=replset --environment=dev --query-source=profiler --enable-all-collectors --agent-password=pmm --max-collections-limit=0
shell> ps -aux | grep mongodb_exporter root 1000594 6.4 0.0 722524 23536 ? Sl 16:58 0:38 /usr/local/percona/pmm2/exporters/mongodb_exporter --collector.collstats --collector.collstats-limit=0 --collector.dbstats --collector.diagnosticdata --collector.indexstats --collector.replicasetstatus --collector.topmetrics --compatible-mode --discovering-mode --mongodb.global-conn-pool --web.listen-address=:42004 root 1009975 0.0 0.0 9052 2628 pts/0 S+ 17:08 0:00 grep --color=auto mongodb_exporter
2. Then, created a fake collection and inserted a few documents:
replset:PRIMARY> db.CS0025955.find() { "_id" : ObjectId("6251e6d8f5254aadb1464c44"), "c32" : 0, "last_modified" : ISODate("2022-04-09T20:04:40.269Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c45"), "c32" : 1, "last_modified" : ISODate("2022-04-09T20:04:40.299Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c46"), "c32" : 2, "last_modified" : ISODate("2022-04-09T20:04:40.302Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c47"), "c32" : 3, "last_modified" : ISODate("2022-04-09T20:04:40.304Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c48"), "c32" : 4, "last_modified" : ISODate("2022-04-09T20:04:40.307Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c49"), "c32" : 5, "last_modified" : ISODate("2022-04-09T20:04:40.309Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c4a"), "c32" : 6, "last_modified" : ISODate("2022-04-09T20:04:40.311Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c4b"), "c32" : 7, "last_modified" : ISODate("2022-04-09T20:04:40.313Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c4c"), "c32" : 8, "last_modified" : ISODate("2022-04-09T20:04:40.315Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c4d"), "c32" : 9, "last_modified" : ISODate("2022-04-09T20:04:40.318Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c4e"), "c32" : 10, "last_modified" : ISODate("2022-04-09T20:04:40.320Z") } { "_id" : ObjectId("6251e6d8f5254aadb1464c4f"), "c32" : 11, "last_modified" : ISODate("2022-04-09T20:04:40.323Z") }
3. After that, the following index structure was deployed:
replset:PRIMARY>db.CS0025955.createIndex({"c32":1}) replset:PRIMARY>db.CS0025955.createIndex({"c32":-1})
[ { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_" }, { "v" : 2, "key" : { "c32" : 1 }, "name" : "c32_1" }, { "v" : 2, "key" : { "c32" : -1 }, "name" : "c32_-1" } ]
4. The next step was to validate the metrics gathering via the curl command:
shell> curl -i http://pmm:[email protected]:42004/metrics
curl: (52) Empty reply from server
**Extra test/scenarios:
1. Dropping only the ascending index:
replset:PRIMARY> db.CS0025955.dropIndex("c32_1") { "nIndexesWas" : 3, "ok" : 1,
shell> curl -i http://pmm:[email protected]:42004/metrics | grep access # TYPE mongodb_CS0026174_person_id_accesses_ops untyped mongodb_CS0026174_person_id_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="_id_",namespace="CS0026174.person",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_CS0025955_c32_1_accesses_ops percona_CS0025955_c32_-1.accesses. # TYPE mongodb_percona_CS0025955_c32_1_accesses_ops untyped mongodb_percona_CS0025955_c32_1_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="c32_-1",namespace="percona.CS0025955",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_CS0025955_id_accesses_ops percona_CS0025955__id_.accesses. # TYPE mongodb_percona_CS0025955_id_accesses_ops untyped
Worked
2. Recreating the ascending and dropping only the descending index:
replset:PRIMARY> db.CS0025955.dropIndex("c32_-1") { "nIndexesWas" : 3, "ok" : 1,
shell> curl -i http://pmm:[email protected]:42004/metrics | grep access # HELP mongodb_CS0026174_person_id_accesses_ops CS0026174_person__id_.accesses. # TYPE mongodb_CS0026174_person_id_accesses_ops untyped mongodb_CS0026174_person_id_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="_id_",namespace="CS0026174.person",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_CS0025955_c32_1_accesses_ops percona_CS0025955_c32_1.accesses. # TYPE mongodb_percona_CS0025955_c32_1_accesses_ops untyped mongodb_percona_CS0025955_c32_1_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="c32_1",namespace="percona.CS0025955",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_CS0025955_id_accesses_ops percona_CS0025955__id_.accesses. # TYPE mongodb_percona_CS0025955_id_accesses_ops untyped
Worked.
4. Using a different collection structure but creating the default ascending and descending indexes:
--- collection sample -- { "_id" : ObjectId("6228eb907e86f06c7d180387"), "field1" : 951, "field2" : 0.5993044711817684, "field3" : "d9168548d905466364a81c1d1520c1e9" } { "_id" : ObjectId("6228eb907e86f06c7d180224"), "field1" : 596, "field2" : 0.11354347580806556, "field3" : "1b6fc233e1cb062ccff127739e70fd55" } { "_id" : ObjectId("6228eb8f7e86f06c7d1800f6"), "field1" : 294, "field2" : 0.10073154000241427, "field3" : "d8b5427bbf24e374231fea4838410c74" } { "_id" : ObjectId("6228eb907e86f06c7d18037e"), "field1" : 942, "field2" : 0.7222825020150281, "field3" : "c29b50c6bbf5d3f247894509aaa928c1" } { "_id" : ObjectId("6228eb907e86f06c7d18024e"), "field1" : 638, "field2" : 0.45752419257402827, "field3" : "f9281fa70be559d48592a520fe728c1c" }
--- index structure --- { "v" : 2, "key" : { "field3" : 1 }, "name" : "field3_1" }, { "v" : 2, "key" : { "field3" : -1 }, "name" : "field3_-1" }
4.1. Then:
shell> curl -i http://pmm:[email protected]:42004/metrics | grep access
curl: (52) Empty reply from server
Not Worked.
5. But, creating the same ascending and descending index, but with non-default names:
{ "v" : 2, "key" : { "field3" : 1 }, "name" : "ascending" }, { "v" : 2, "key" : { "field3" : -1 }, "name" : "descending" }
shell> curl -i http://pmm:[email protected]:42004/metrics | grep access # HELP mongodb_CS0026174_person_id_accesses_ops CS0026174_person__id_.accesses. # TYPE mongodb_CS0026174_person_id_accesses_ops untyped mongodb_CS0026174_person_id_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="_id_",namespace="CS0026174.person",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_date_id_accesses_ops percona_date__id_.accesses. # TYPE mongodb_percona_date_id_accesses_ops untyped mongodb_percona_date_id_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="_id_",namespace="percona.date",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_tagTest_id_accesses_ops percona_tagTest__id_.accesses. [...] mongodb_percona_test_collection_ascending_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="ascending",namespace="percona.test_collection",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_test_collection_descending_accesses_ops percona_test_collection_descending.accesses. # TYPE mongodb_percona_test_collection_descending_accesses_ops untyped mongodb_percona_test_collection_descending_accesses_ops{cl_id="619bfecfd077ff94db2b1ee7",cl_role="",key_name="descending",namespace="percona.test_collection",rs_nm="replset",rs_state="1"} 0 # HELP mongodb_percona_test_collection_id_accesses_ops percona_test_collection__id_.accesses. # TYPE mongodb_percona_test_collection_id_accesses_ops untyped
It Worked.