summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/telemetry/application_name_find.js
diff options
context:
space:
mode:
authorliubov.molchanova <liubov.molchanova@mongodb.com>2023-05-17 08:16:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 10:20:42 +0000
commit87160f876c6fb94f5d03062b2caee57539ec5d8e (patch)
treeb78d9ca9e853a236e0a2f6432a6ac02dc50119cd /jstests/noPassthrough/telemetry/application_name_find.js
parent1c390a0c50104a04cbd8ecbefb99eaf22e1bc914 (diff)
downloadmongo-87160f876c6fb94f5d03062b2caee57539ec5d8e.tar.gz
Revert "SERVER-76427: Rename $telemetry to $queryStats"
This reverts commit d646e44b7801a3e5b3230bbae7dcfe05a5ed8707.
Diffstat (limited to 'jstests/noPassthrough/telemetry/application_name_find.js')
-rw-r--r--jstests/noPassthrough/telemetry/application_name_find.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/jstests/noPassthrough/telemetry/application_name_find.js b/jstests/noPassthrough/telemetry/application_name_find.js
new file mode 100644
index 00000000000..35b86a95f53
--- /dev/null
+++ b/jstests/noPassthrough/telemetry/application_name_find.js
@@ -0,0 +1,39 @@
+/**
+ * Test that applicationName and namespace appear in telemetry for the find command.
+ * @tags: [featureFlagTelemetry]
+ */
+load("jstests/libs/telemetry_utils.js");
+(function() {
+"use strict";
+
+const kApplicationName = "MongoDB Shell";
+const kHashedCollName = "w6Ax20mVkbJu4wQWAMjL8Sl+DfXAr2Zqdc3kJRB7Oo0=";
+const kHashedFieldName = "lU7Z0mLRPRUL+RfAD5jhYPRRpXBsZBxS/20EzDwfOG4=";
+
+// Turn on the collecting of telemetry metrics.
+let options = {
+ setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+};
+
+const conn = MongoRunner.runMongod(options);
+conn.setLogLevel(3, "query");
+const testDB = conn.getDB('test');
+var coll = testDB[jsTestName()];
+coll.drop();
+
+coll.insert({v: 1});
+coll.insert({v: 2});
+coll.insert({v: 3});
+
+coll.find({v: 1}).toArray();
+
+let telemetry = getTelemetry(conn);
+assert.eq(1, telemetry.length, telemetry);
+assert.eq(kApplicationName, telemetry[0].key.applicationName, telemetry);
+
+telemetry = getTelemetryRedacted(conn, true);
+assert.eq(1, telemetry.length, telemetry);
+assert.eq(kApplicationName, telemetry[0].key.applicationName, telemetry);
+
+MongoRunner.stopMongod(conn);
+}());