diff options
author | Will Buerger <will.buerger@mongodb.com> | 2023-05-17 11:49:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-17 12:58:52 +0000 |
commit | ae65ecae5514adc99d60b7396137a1acf2b44335 (patch) | |
tree | 24169f9a640321bfbbec649e869fe51b273b35e3 /jstests/noPassthrough/queryStats/application_name_find.js | |
parent | 1b4a551a6b8c85611e26857217ce1a1e1363e716 (diff) | |
download | mongo-ae65ecae5514adc99d60b7396137a1acf2b44335.tar.gz |
SERVER-76427 Rename $telemetry to $queryStats
Diffstat (limited to 'jstests/noPassthrough/queryStats/application_name_find.js')
-rw-r--r-- | jstests/noPassthrough/queryStats/application_name_find.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/jstests/noPassthrough/queryStats/application_name_find.js b/jstests/noPassthrough/queryStats/application_name_find.js new file mode 100644 index 00000000000..36245a31514 --- /dev/null +++ b/jstests/noPassthrough/queryStats/application_name_find.js @@ -0,0 +1,39 @@ +/** + * Test that applicationName and namespace appear in telemetry for the find command. + * @tags: [featureFlagQueryStats] + */ +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: {internalQueryStatsSamplingRate: -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); +}()); |