summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorWill Buerger <will.buerger@mongodb.com>2023-05-17 11:49:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 12:58:52 +0000
commitae65ecae5514adc99d60b7396137a1acf2b44335 (patch)
tree24169f9a640321bfbbec649e869fe51b273b35e3 /jstests
parent1b4a551a6b8c85611e26857217ce1a1e1363e716 (diff)
downloadmongo-ae65ecae5514adc99d60b7396137a1acf2b44335.tar.gz
SERVER-76427 Rename $telemetry to $queryStats
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/lib/commands_lib.js6
-rw-r--r--jstests/libs/telemetry_utils.js6
-rw-r--r--jstests/noPassthrough/queryStats/application_name_find.js (renamed from jstests/noPassthrough/telemetry/application_name_find.js)4
-rw-r--r--jstests/noPassthrough/queryStats/clear_query_stats_store.js (renamed from jstests/noPassthrough/telemetry/clear_telemetry_store.js)23
-rw-r--r--jstests/noPassthrough/queryStats/documentSourceQueryStats_redaction_parameters.js (renamed from jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js)28
-rw-r--r--jstests/noPassthrough/queryStats/feature_flag_off_sampling_rate_on.js (renamed from jstests/noPassthrough/telemetry/feature_flag_off_sampling_rate_on.js)8
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_collect_on_mongos.js (renamed from jstests/noPassthrough/telemetry/telemetry_collect_on_mongos.js)10
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_feature_flag.js (renamed from jstests/noPassthrough/telemetry/telemetry_feature_flag.js)8
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_key.js (renamed from jstests/noPassthrough/telemetry/query_stats_key.js)4
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_metrics_across_getMore_calls.js (renamed from jstests/noPassthrough/telemetry/telemetry_metrics_across_getMore_calls.js)16
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_redact_find_cmd.js (renamed from jstests/noPassthrough/telemetry/telemetry_redact_find_cmd.js)10
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_sampling_rate.js (renamed from jstests/noPassthrough/telemetry/telemetry_sampling_rate.js)12
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_server_status_metrics.js (renamed from jstests/noPassthrough/telemetry/telemetry_server_status_metrics.js)47
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_upgrade.js (renamed from jstests/noPassthrough/telemetry/telemetry_upgrade.js)8
-rw-r--r--jstests/noPassthrough/queryStats/redact_queries_with_nonobject_fields.js (renamed from jstests/noPassthrough/telemetry/redact_queries_with_nonobject_fields.js)4
-rw-r--r--jstests/noPassthroughWithMongod/query_stats_configuration.js (renamed from jstests/noPassthroughWithMongod/telemetry_configuration.js)12
16 files changed, 97 insertions, 109 deletions
diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js
index 170223762b4..1d60c7aa308 100644
--- a/jstests/auth/lib/commands_lib.js
+++ b/jstests/auth/lib/commands_lib.js
@@ -6629,12 +6629,12 @@ export const authCommandsLib = {
]
},
{
- // Test that only clusterManager has permission to run $telemetry
+ // Test that only clusterManager has permission to run $queryStats
testname: "testTelemetryReadPrivilege",
- command: {aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}},
+ command: {aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}},
skipSharded: false,
skipTest: (conn) => {
- return !TestData.setParameters.featureFlagTelemetry;
+ return !TestData.setParameters.featureFlagQueryStats;
},
testcases: [{runOnDb: adminDbName, roles: roles_clusterManager}]
},
diff --git a/jstests/libs/telemetry_utils.js b/jstests/libs/telemetry_utils.js
index 11e2d236827..0bb9e90fb58 100644
--- a/jstests/libs/telemetry_utils.js
+++ b/jstests/libs/telemetry_utils.js
@@ -45,7 +45,7 @@ function getTelemetry(conn) {
const result = conn.adminCommand({
aggregate: 1,
pipeline: [
- {$telemetry: {}},
+ {$queryStats: {}},
// Sort on telemetry key so entries are in a deterministic order.
{$sort: {key: 1}},
{$match: {"key.applicationName": kApplicationName}}
@@ -62,7 +62,7 @@ function getTelemetryRedacted(
hmacKey = BinData(0, "MjM0NTY3ODkxMDExMTIxMzE0MTUxNjE3MTgxOTIwMjE=")) {
// Hashed application name is generated using the default hmacKey argument.
const kApplicationName = "MongoDB Shell";
- // Filter out agg queries, including $telemetry.
+ // Filter out agg queries, including $queryStats.
const match = {
$match: {"key.queryShape.command": "find", "key.applicationName": kApplicationName}
};
@@ -70,7 +70,7 @@ function getTelemetryRedacted(
const result = conn.adminCommand({
aggregate: 1,
pipeline: [
- {$telemetry: {applyHmacToIdentifiers: applyHmacToIdentifiers, hmacKey: hmacKey}},
+ {$queryStats: {applyHmacToIdentifiers: applyHmacToIdentifiers, hmacKey: hmacKey}},
match,
// Sort on telemetry key so entries are in a deterministic order.
{$sort: {key: 1}},
diff --git a/jstests/noPassthrough/telemetry/application_name_find.js b/jstests/noPassthrough/queryStats/application_name_find.js
index 35b86a95f53..36245a31514 100644
--- a/jstests/noPassthrough/telemetry/application_name_find.js
+++ b/jstests/noPassthrough/queryStats/application_name_find.js
@@ -1,6 +1,6 @@
/**
* Test that applicationName and namespace appear in telemetry for the find command.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load("jstests/libs/telemetry_utils.js");
(function() {
@@ -12,7 +12,7 @@ const kHashedFieldName = "lU7Z0mLRPRUL+RfAD5jhYPRRpXBsZBxS/20EzDwfOG4=";
// Turn on the collecting of telemetry metrics.
let options = {
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
};
const conn = MongoRunner.runMongod(options);
diff --git a/jstests/noPassthrough/telemetry/clear_telemetry_store.js b/jstests/noPassthrough/queryStats/clear_query_stats_store.js
index b2409cc0bbb..9c2b888cd76 100644
--- a/jstests/noPassthrough/telemetry/clear_telemetry_store.js
+++ b/jstests/noPassthrough/queryStats/clear_query_stats_store.js
@@ -1,6 +1,6 @@
/**
* Test that the telemetry store can be cleared when the cache size is reset to 0.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load("jstests/libs/telemetry_utils.js"); // For verifyMetrics.
@@ -9,10 +9,7 @@ load("jstests/libs/telemetry_utils.js"); // For verifyMetrics.
// Turn on the collecting of telemetry metrics.
let options = {
- setParameter: {
- internalQueryConfigureTelemetrySamplingRate: -1,
- internalQueryConfigureTelemetryCacheSize: "10MB"
- },
+ setParameter: {internalQueryStatsSamplingRate: -1, internalQueryStatsCacheSize: "10MB"},
};
const conn = MongoRunner.runMongod(options);
@@ -29,18 +26,18 @@ for (var j = 0; j < 10; ++j) {
}
// Confirm number of entries in the store and that none have been evicted.
-let telemetryResults = testDB.getSiblingDB("admin").aggregate([{$telemetry: {}}]).toArray();
+let telemetryResults = testDB.getSiblingDB("admin").aggregate([{$queryStats: {}}]).toArray();
assert.eq(telemetryResults.length, 10, telemetryResults);
-assert.eq(testDB.serverStatus().metrics.telemetry.numEvicted, 0);
+assert.eq(testDB.serverStatus().metrics.queryStats.numEvicted, 0);
// Command to clear the cache.
-assert.commandWorked(
- testDB.adminCommand({setParameter: 1, internalQueryConfigureTelemetryCacheSize: "0MB"}));
+assert.commandWorked(testDB.adminCommand({setParameter: 1, internalQueryStatsCacheSize: "0MB"}));
-// 10 regular queries plus the $telemetry query, means 11 entries evicted when the cache is cleared.
-assert.eq(testDB.serverStatus().metrics.telemetry.numEvicted, 11);
+// 10 regular queries plus the $queryStats query, means 11 entries evicted when the cache is
+// cleared.
+assert.eq(testDB.serverStatus().metrics.queryStats.numEvicted, 11);
-// Calling $telemetry should fail when the telemetry store size is 0 bytes.
-assert.throwsWithCode(() => testDB.getSiblingDB("admin").aggregate([{$telemetry: {}}]), 6579000);
+// Calling $queryStats should fail when the telemetry store size is 0 bytes.
+assert.throwsWithCode(() => testDB.getSiblingDB("admin").aggregate([{$queryStats: {}}]), 6579000);
MongoRunner.stopMongod(conn);
}());
diff --git a/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js b/jstests/noPassthrough/queryStats/documentSourceQueryStats_redaction_parameters.js
index c4f785abf6a..8facb106072 100644
--- a/jstests/noPassthrough/telemetry/documentSourceTelemetry_redaction_parameters.js
+++ b/jstests/noPassthrough/queryStats/documentSourceQueryStats_redaction_parameters.js
@@ -1,6 +1,6 @@
/**
- * Test the $telemetry hmac properties.
- * @tags: [featureFlagTelemetry]
+ * Test the $queryStats hmac properties.
+ * @tags: [featureFlagQueryStats]
*/
load("jstests/aggregation/extras/utils.js"); // For assertAdminDBErrCodeAndErrMsgContains.
@@ -42,41 +42,41 @@ function runTest(conn) {
assertTelemetryKeyWithoutHmac(getTelemetryRedacted(conn, false)[0]["key"].queryShape);
// Wrong parameter name throws error.
- let pipeline = [{$telemetry: {redactFields: true}}];
+ let pipeline = [{$queryStats: {redactFields: true}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry parameters object may only contain 'applyHmacToIdentifiers' or 'hmacKey' options. Found: redactFields");
+ "$queryStats parameters object may only contain 'applyHmacToIdentifiers' or 'hmacKey' options. Found: redactFields");
// Wrong parameter type throws error.
- pipeline = [{$telemetry: {applyHmacToIdentifiers: 1}}];
+ pipeline = [{$queryStats: {applyHmacToIdentifiers: 1}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry applyHmacToIdentifiers parameter must be boolean. Found type: double");
+ "$queryStats applyHmacToIdentifiers parameter must be boolean. Found type: double");
- pipeline = [{$telemetry: {hmacKey: 1}}];
+ pipeline = [{$queryStats: {hmacKey: 1}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry hmacKey parameter must be bindata of length 32 or greater. Found type: double");
+ "$queryStats hmacKey parameter must be bindata of length 32 or greater. Found type: double");
// Parameter object with unrecognized key throws error.
- pipeline = [{$telemetry: {applyHmacToIdentifiers: true, hmacStrategy: "on"}}];
+ pipeline = [{$queryStats: {applyHmacToIdentifiers: true, hmacStrategy: "on"}}];
assertAdminDBErrCodeAndErrMsgContains(
coll,
pipeline,
ErrorCodes.FailedToParse,
- "$telemetry parameters object may only contain 'applyHmacToIdentifiers' or 'hmacKey' options. Found: hmacStrategy");
+ "$queryStats parameters object may only contain 'applyHmacToIdentifiers' or 'hmacKey' options. Found: hmacStrategy");
}
const conn = MongoRunner.runMongod({
setParameter: {
- internalQueryConfigureTelemetrySamplingRate: -1,
- featureFlagTelemetry: true,
+ internalQueryStatsSamplingRate: -1,
+ featureFlagQueryStats: true,
}
});
runTest(conn);
@@ -89,8 +89,8 @@ const st = new ShardingTest({
rs: {nodes: 1},
mongosOptions: {
setParameter: {
- internalQueryConfigureTelemetrySamplingRate: -1,
- featureFlagTelemetry: true,
+ internalQueryStatsSamplingRate: -1,
+ featureFlagQueryStats: true,
'failpoint.skipClusterParameterRefresh': "{'mode':'alwaysOn'}"
}
},
diff --git a/jstests/noPassthrough/telemetry/feature_flag_off_sampling_rate_on.js b/jstests/noPassthrough/queryStats/feature_flag_off_sampling_rate_on.js
index 7fbc079cc7b..38474b944d0 100644
--- a/jstests/noPassthrough/telemetry/feature_flag_off_sampling_rate_on.js
+++ b/jstests/noPassthrough/queryStats/feature_flag_off_sampling_rate_on.js
@@ -10,14 +10,14 @@ load("jstests/libs/feature_flag_util.js");
// Set sampling rate to -1.
let options = {
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
};
const conn = MongoRunner.runMongod(options);
const testdb = conn.getDB('test');
// This test specifically tests error handling when the feature flag is not on.
// TODO SERVER-65800 This test can be deleted when the feature is on by default.
-if (!conn || FeatureFlagUtil.isEnabled(testdb, "Telemetry")) {
+if (!conn || FeatureFlagUtil.isEnabled(testdb, "QueryStats")) {
jsTestLog(`Skipping test since feature flag is disabled. conn: ${conn}`);
if (conn) {
MongoRunner.stopMongod(conn);
@@ -38,14 +38,14 @@ assert.commandWorked(bulk.execute());
// Pipeline to read telemetry store should fail without feature flag turned on even though sampling
// rate is > 0.
assert.commandFailedWithCode(
- testdb.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}),
+ testdb.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}}),
ErrorCodes.QueryFeatureNotAllowed);
// Pipeline, with a filter, to read telemetry store fails without feature flag turned on even though
// sampling rate is > 0.
assert.commandFailedWithCode(testdb.adminCommand({
aggregate: 1,
- pipeline: [{$telemetry: {}}, {$match: {"key.queryShape.find": {$eq: "###"}}}],
+ pipeline: [{$queryStats: {}}, {$match: {"key.queryShape.find": {$eq: "###"}}}],
cursor: {}
}),
ErrorCodes.QueryFeatureNotAllowed);
diff --git a/jstests/noPassthrough/telemetry/telemetry_collect_on_mongos.js b/jstests/noPassthrough/queryStats/query_stats_collect_on_mongos.js
index ff9fadc85c7..97057269527 100644
--- a/jstests/noPassthrough/telemetry/telemetry_collect_on_mongos.js
+++ b/jstests/noPassthrough/queryStats/query_stats_collect_on_mongos.js
@@ -1,6 +1,6 @@
/**
* Test that mongos is collecting telemetry metrics.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load('jstests/libs/telemetry_utils.js');
@@ -18,7 +18,7 @@ const setup = () => {
rs: {nodes: 1},
mongosOptions: {
setParameter: {
- internalQueryConfigureTelemetrySamplingRate: -1,
+ internalQueryStatsSamplingRate: -1,
'failpoint.skipClusterParameterRefresh': "{'mode':'alwaysOn'}"
}
},
@@ -95,7 +95,8 @@ const assertExpectedResults = (results,
collection: coll.getName(),
batchSize: 2
})); // returns 1 doc, exhausts the cursor
- // The $telemetry query for the previous `getTelemetry` is included in this call to $telemetry.
+ // The $queryStats query for the previous `getTelemetry` is included in this call to
+ // $queryStats.
telemetry = getTelemetry(db);
assert.eq(2, telemetry.length, telemetry);
assertExpectedResults(telemetry[0],
@@ -159,7 +160,8 @@ const assertExpectedResults = (results,
collection: coll.getName(),
batchSize: 2
})); // returns 1 doc, exhausts the cursor
- // The $telemetry query for the previous `getTelemetry` is included in this call to $telemetry.
+ // The $queryStats query for the previous `getTelemetry` is included in this call to
+ // $queryStats.
telemetry = getTelemetry(db);
assert.eq(2, telemetry.length, telemetry);
assertExpectedResults(telemetry[0],
diff --git a/jstests/noPassthrough/telemetry/telemetry_feature_flag.js b/jstests/noPassthrough/queryStats/query_stats_feature_flag.js
index 4071b732796..bcce489d8da 100644
--- a/jstests/noPassthrough/telemetry/telemetry_feature_flag.js
+++ b/jstests/noPassthrough/queryStats/query_stats_feature_flag.js
@@ -11,21 +11,21 @@ load("jstests/libs/feature_flag_util.js");
// TODO SERVER-65800 this test can be removed when the feature flag is removed.
const conn = MongoRunner.runMongod();
const testDB = conn.getDB('test');
-if (FeatureFlagUtil.isEnabled(testDB, "Telemetry")) {
- jsTestLog("Skipping test since telemetry is enabled.");
+if (FeatureFlagUtil.isEnabled(testDB, "QueryStats")) {
+ jsTestLog("Skipping test since query stats are enabled.");
MongoRunner.stopMongod(conn);
return;
}
// Pipeline to read telemetry store should fail without feature flag turned on.
assert.commandFailedWithCode(
- testDB.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}),
+ testDB.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}}),
ErrorCodes.QueryFeatureNotAllowed);
// Pipeline, with a filter, to read telemetry store fails without feature flag turned on.
assert.commandFailedWithCode(testDB.adminCommand({
aggregate: 1,
- pipeline: [{$telemetry: {}}, {$match: {"key.queryShape.find": {$eq: "###"}}}],
+ pipeline: [{$queryStats: {}}, {$match: {"key.queryShape.find": {$eq: "###"}}}],
cursor: {}
}),
ErrorCodes.QueryFeatureNotAllowed);
diff --git a/jstests/noPassthrough/telemetry/query_stats_key.js b/jstests/noPassthrough/queryStats/query_stats_key.js
index 68d77110bc6..1c6a47e4ed5 100644
--- a/jstests/noPassthrough/telemetry/query_stats_key.js
+++ b/jstests/noPassthrough/queryStats/query_stats_key.js
@@ -1,6 +1,6 @@
/**
* This test confirms that telemetry store key fields are properly nested and none are missing.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load("jstests/libs/telemetry_utils.js");
(function() {
@@ -64,7 +64,7 @@ function confirmAllFieldsPresent(queryStatsEntries) {
// Turn on the collecting of telemetry metrics.
let options = {
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
};
const conn = MongoRunner.runMongod(options);
diff --git a/jstests/noPassthrough/telemetry/telemetry_metrics_across_getMore_calls.js b/jstests/noPassthrough/queryStats/query_stats_metrics_across_getMore_calls.js
index 91605c5e069..d5caea74cf7 100644
--- a/jstests/noPassthrough/telemetry/telemetry_metrics_across_getMore_calls.js
+++ b/jstests/noPassthrough/queryStats/query_stats_metrics_across_getMore_calls.js
@@ -1,7 +1,7 @@
/**
* Test that the telemetry metrics are aggregated properly by distinct query shape over getMore
* calls.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load("jstests/libs/telemetry_utils.js"); // For verifyMetrics.
@@ -10,7 +10,7 @@ load("jstests/libs/telemetry_utils.js"); // For verifyMetrics.
// Turn on the collecting of telemetry metrics.
let options = {
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
};
const conn = MongoRunner.runMongod(options);
@@ -35,7 +35,7 @@ assert.commandWorked(bulk.execute());
coll.aggregate([{$match: {foo: 0}}], {cursor: {batchSize: 2}}).toArray();
// This command will return all telemetry store entires.
- const telemetryResults = testDB.getSiblingDB("admin").aggregate([{$telemetry: {}}]).toArray();
+ const telemetryResults = testDB.getSiblingDB("admin").aggregate([{$queryStats: {}}]).toArray();
// Assert there is only one entry.
assert.eq(telemetryResults.length, 1, telemetryResults);
const telemetryEntry = telemetryResults[0];
@@ -71,7 +71,7 @@ const fooNeBatchSize = 3;
// This filters telemetry entires to just the ones entered when running above find queries.
const telemetryResults = testDB.getSiblingDB("admin")
.aggregate([
- {$telemetry: {}},
+ {$queryStats: {}},
{$match: {"key.queryShape.filter.foo": {$exists: true}}},
{$sort: {key: 1}},
])
@@ -102,7 +102,7 @@ const fooNeBatchSize = 3;
// This filters telemetry entires to just the ones entered when running above find queries.
let telemetryResults =
testDB.getSiblingDB("admin")
- .aggregate([{$telemetry: {}}, {$match: {"key.queryShape.command": "find"}}])
+ .aggregate([{$queryStats: {}}, {$match: {"key.queryShape.command": "find"}}])
.toArray();
assert.eq(telemetryResults.length, 4, telemetryResults);
@@ -110,7 +110,7 @@ const fooNeBatchSize = 3;
// This filters to just the telemetry for query coll.find().sort({"foo": 1}).batchSize(2).
telemetryResults = testDB.getSiblingDB("admin")
- .aggregate([{$telemetry: {}}, {$match: {"key.queryShape.sort.foo": 1}}])
+ .aggregate([{$queryStats: {}}, {$match: {"key.queryShape.sort.foo": 1}}])
.toArray();
assert.eq(telemetryResults.length, 1, telemetryResults);
assert.eq(telemetryResults[0].key.queryShape.cmdNs.db, "test");
@@ -123,7 +123,7 @@ const fooNeBatchSize = 3;
// 1}}).limit(query2Limit).batchSize(2).
telemetryResults =
testDB.getSiblingDB("admin")
- .aggregate([{$telemetry: {}}, {$match: {"key.queryShape.limit": '?number'}}])
+ .aggregate([{$queryStats: {}}, {$match: {"key.queryShape.limit": '?number'}}])
.toArray();
assert.eq(telemetryResults.length, 1, telemetryResults);
assert.eq(telemetryResults[0].key.queryShape.cmdNs.db, "test");
@@ -135,7 +135,7 @@ const fooNeBatchSize = 3;
// This filters to just the telemetry for query coll.find({foo: {$eq: 0}}).batchSize(2).
telemetryResults = testDB.getSiblingDB("admin")
.aggregate([
- {$telemetry: {}},
+ {$queryStats: {}},
{
$match: {
"key.queryShape.filter.foo": {$eq: {$eq: "?number"}},
diff --git a/jstests/noPassthrough/telemetry/telemetry_redact_find_cmd.js b/jstests/noPassthrough/queryStats/query_stats_redact_find_cmd.js
index 54b909adae9..b2cce48cdb7 100644
--- a/jstests/noPassthrough/telemetry/telemetry_redact_find_cmd.js
+++ b/jstests/noPassthrough/queryStats/query_stats_redact_find_cmd.js
@@ -1,5 +1,5 @@
/**
- * Test that $telemetry properly applies hmac to find commands, on mongod and mongos.
+ * Test that $queryStats properly applies hmac to find commands, on mongod and mongos.
*/
load("jstests/libs/telemetry_utils.js");
(function() {
@@ -44,8 +44,8 @@ function runTest(conn) {
const conn = MongoRunner.runMongod({
setParameter: {
- internalQueryConfigureTelemetrySamplingRate: -1,
- featureFlagTelemetry: true,
+ internalQueryStatsSamplingRate: -1,
+ featureFlagQueryStats: true,
}
});
runTest(conn);
@@ -58,8 +58,8 @@ const st = new ShardingTest({
rs: {nodes: 1},
mongosOptions: {
setParameter: {
- internalQueryConfigureTelemetrySamplingRate: -1,
- featureFlagTelemetry: true,
+ internalQueryStatsSamplingRate: -1,
+ featureFlagQueryStats: true,
'failpoint.skipClusterParameterRefresh': "{'mode':'alwaysOn'}"
}
},
diff --git a/jstests/noPassthrough/telemetry/telemetry_sampling_rate.js b/jstests/noPassthrough/queryStats/query_stats_sampling_rate.js
index 1bada398a03..009c59737fa 100644
--- a/jstests/noPassthrough/telemetry/telemetry_sampling_rate.js
+++ b/jstests/noPassthrough/queryStats/query_stats_sampling_rate.js
@@ -1,7 +1,7 @@
/**
* Test that calls to read from telemetry store fail when sampling rate is not greater than 0 even
* if feature flag is on.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load('jstests/libs/analyze_plan.js');
@@ -9,7 +9,7 @@ load('jstests/libs/analyze_plan.js');
"use strict";
let options = {
- setParameter: {internalQueryConfigureTelemetrySamplingRate: 0},
+ setParameter: {internalQueryStatsSamplingRate: 0},
};
const conn = MongoRunner.runMongod(options);
@@ -23,15 +23,15 @@ for (var i = 0; i < 20; i++) {
coll.aggregate([{$match: {foo: 1}}], {cursor: {batchSize: 2}});
// Reading telemetry store with a sampling rate of 0 should return 0 documents.
-let telStore = testdb.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}});
+let telStore = testdb.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}});
assert.eq(telStore.cursor.firstBatch.length, 0);
// Reading telemetry store should work now with a sampling rate of greater than 0.
-assert.commandWorked(testdb.adminCommand(
- {setParameter: 1, internalQueryConfigureTelemetrySamplingRate: 2147483647}));
+assert.commandWorked(
+ testdb.adminCommand({setParameter: 1, internalQueryStatsSamplingRate: 2147483647}));
coll.aggregate([{$match: {foo: 1}}], {cursor: {batchSize: 2}});
telStore = assert.commandWorked(
- testdb.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}));
+ testdb.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}}));
assert.eq(telStore.cursor.firstBatch.length, 1);
MongoRunner.stopMongod(conn);
diff --git a/jstests/noPassthrough/telemetry/telemetry_server_status_metrics.js b/jstests/noPassthrough/queryStats/query_stats_server_status_metrics.js
index 2235d272a9f..2bc7d808898 100644
--- a/jstests/noPassthrough/telemetry/telemetry_server_status_metrics.js
+++ b/jstests/noPassthrough/queryStats/query_stats_server_status_metrics.js
@@ -1,6 +1,6 @@
/**
* Test the telemetry related serverStatus metrics.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load('jstests/libs/analyze_plan.js');
@@ -23,7 +23,7 @@ function runTestWithMongodOptions(mongodOptions, test, testOptions) {
* testOptions must include `resetCacheSize` bool field; e.g., { resetCacheSize : true }
*/
function evictionTest(conn, testDB, coll, testOptions) {
- const evictedBefore = testDB.serverStatus().metrics.telemetry.numEvicted;
+ const evictedBefore = testDB.serverStatus().metrics.queryStats.numEvicted;
assert.eq(evictedBefore, 0);
for (var i = 0; i < 4000; i++) {
let query = {};
@@ -31,16 +31,16 @@ function evictionTest(conn, testDB, coll, testOptions) {
coll.aggregate([{$match: query}]).itcount();
}
if (!testOptions.resetCacheSize) {
- const evictedAfter = testDB.serverStatus().metrics.telemetry.numEvicted;
+ const evictedAfter = testDB.serverStatus().metrics.queryStats.numEvicted;
assert.gt(evictedAfter, 0);
return;
}
// Make sure number of evicted entries increases when the cache size is reset, which forces out
// least recently used entries to meet the new, smaller size requirement.
- assert.eq(testDB.serverStatus().metrics.telemetry.numEvicted, 0);
+ assert.eq(testDB.serverStatus().metrics.queryStats.numEvicted, 0);
assert.commandWorked(
- testDB.adminCommand({setParameter: 1, internalQueryConfigureTelemetryCacheSize: "1MB"}));
- const evictedAfter = testDB.serverStatus().metrics.telemetry.numEvicted;
+ testDB.adminCommand({setParameter: 1, internalQueryStatsCacheSize: "1MB"}));
+ const evictedAfter = testDB.serverStatus().metrics.queryStats.numEvicted;
assert.gt(evictedAfter, 0);
}
@@ -53,7 +53,7 @@ function evictionTest(conn, testDB, coll, testOptions) {
*/
function countRateLimitedRequestsTest(conn, testDB, coll, testOptions) {
const numRateLimitedRequestsBefore =
- testDB.serverStatus().metrics.telemetry.numRateLimitedRequests;
+ testDB.serverStatus().metrics.queryStats.numRateLimitedRequests;
assert.eq(numRateLimitedRequestsBefore, 0);
coll.insert({a: 0});
@@ -65,7 +65,7 @@ function countRateLimitedRequestsTest(conn, testDB, coll, testOptions) {
}
const numRateLimitedRequestsAfter =
- testDB.serverStatus().metrics.telemetry.numRateLimitedRequests;
+ testDB.serverStatus().metrics.queryStats.numRateLimitedRequests;
if (testOptions.samplingRate === 0) {
// Telemetry should not be collected for any requests.
@@ -81,7 +81,7 @@ function countRateLimitedRequestsTest(conn, testDB, coll, testOptions) {
}
function telemetryStoreSizeEstimateTest(conn, testDB, coll, testOptions) {
- assert.eq(testDB.serverStatus().metrics.telemetry.telemetryStoreSizeEstimateBytes, 0);
+ assert.eq(testDB.serverStatus().metrics.queryStats.queryStatsStoreSizeEstimateBytes, 0);
let halfWayPointSize;
// Only using three digit numbers (eg 100, 101) means the string length will be the same for all
// entries and therefore the key size will be the same for all entries, which makes predicting
@@ -90,12 +90,12 @@ function telemetryStoreSizeEstimateTest(conn, testDB, coll, testOptions) {
coll.aggregate([{$match: {["foo" + i]: "bar"}}]).itcount();
if (i == 150) {
halfWayPointSize =
- testDB.serverStatus().metrics.telemetry.telemetryStoreSizeEstimateBytes;
+ testDB.serverStatus().metrics.queryStats.queryStatsStoreSizeEstimateBytes;
}
}
// Confirm that telemetry store has grown and size is non-zero.
assert.gt(halfWayPointSize, 0);
- const fullSize = testDB.serverStatus().metrics.telemetry.telemetryStoreSizeEstimateBytes;
+ const fullSize = testDB.serverStatus().metrics.queryStats.queryStatsStoreSizeEstimateBytes;
assert.gt(fullSize, 0);
// Make sure the final telemetry store size is twice as much as the halfway point size (+/- 5%)
assert(fullSize >= halfWayPointSize * 1.95 && fullSize <= halfWayPointSize * 2.05,
@@ -109,7 +109,7 @@ function telemetryStoreWriteErrorsTest(conn, testDB, coll, testOptions) {
return;
}
- const errorsBefore = testDB.serverStatus().metrics.telemetry.numTelemetryStoreWriteErrors;
+ const errorsBefore = testDB.serverStatus().metrics.queryStats.numQueryStatsStoreWriteErrors;
assert.eq(errorsBefore, 0);
for (let i = 0; i < 5; i++) {
// Command should succeed and record the error.
@@ -121,7 +121,7 @@ function telemetryStoreWriteErrorsTest(conn, testDB, coll, testOptions) {
// Make sure that we recorded a write error for each run.
// TODO SERVER-73152 we attempt to write to the telemetry store twice for each aggregate, which
// seems wrong.
- assert.eq(testDB.serverStatus().metrics.telemetry.numTelemetryStoreWriteErrors, 10);
+ assert.eq(testDB.serverStatus().metrics.queryStats.numQueryStatsStoreWriteErrors, 10);
}
/**
@@ -129,10 +129,7 @@ function telemetryStoreWriteErrorsTest(conn, testDB, coll, testOptions) {
* eviction.
*/
runTestWithMongodOptions({
- setParameter: {
- internalQueryConfigureTelemetryCacheSize: "1MB",
- internalQueryConfigureTelemetrySamplingRate: -1
- },
+ setParameter: {internalQueryStatsCacheSize: "1MB", internalQueryStatsSamplingRate: -1},
},
evictionTest,
{resetCacheSize: false});
@@ -140,10 +137,7 @@ runTestWithMongodOptions({
* In this configuration, eviction is triggered only when the telemetry store size is reset.
* */
runTestWithMongodOptions({
- setParameter: {
- internalQueryConfigureTelemetryCacheSize: "4MB",
- internalQueryConfigureTelemetrySamplingRate: -1
- },
+ setParameter: {internalQueryStatsCacheSize: "4MB", internalQueryStatsSamplingRate: -1},
},
evictionTest,
{resetCacheSize: true});
@@ -152,7 +146,7 @@ runTestWithMongodOptions({
* In this configuration, every query is sampled, so no requests should be rate-limited.
*/
runTestWithMongodOptions({
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
},
countRateLimitedRequestsTest,
{samplingRate: 2147483647, numRequests: 20});
@@ -162,7 +156,7 @@ runTestWithMongodOptions({
* rate-limited.
*/
runTestWithMongodOptions({
- setParameter: {internalQueryConfigureTelemetrySamplingRate: 10},
+ setParameter: {internalQueryStatsSamplingRate: 10},
},
countRateLimitedRequestsTest,
{samplingRate: 10, numRequests: 20});
@@ -172,7 +166,7 @@ runTestWithMongodOptions({
* size
*/
runTestWithMongodOptions({
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
},
telemetryStoreSizeEstimateTest);
@@ -181,10 +175,7 @@ runTestWithMongodOptions({
* are tracked.
*/
runTestWithMongodOptions({
- setParameter: {
- internalQueryConfigureTelemetryCacheSize: "0.00001MB",
- internalQueryConfigureTelemetrySamplingRate: -1
- },
+ setParameter: {internalQueryStatsCacheSize: "0.00001MB", internalQueryStatsSamplingRate: -1},
},
telemetryStoreWriteErrorsTest);
}());
diff --git a/jstests/noPassthrough/telemetry/telemetry_upgrade.js b/jstests/noPassthrough/queryStats/query_stats_upgrade.js
index f396d23b948..919d9f87baf 100644
--- a/jstests/noPassthrough/telemetry/telemetry_upgrade.js
+++ b/jstests/noPassthrough/queryStats/query_stats_upgrade.js
@@ -1,6 +1,6 @@
/**
* Test that telemetry doesn't work on a lower FCV version but works after an FCV upgrade.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load('jstests/libs/analyze_plan.js');
load("jstests/libs/feature_flag_util.js");
@@ -12,7 +12,7 @@ const dbpath = MongoRunner.dataPath + jsTestName();
let conn = MongoRunner.runMongod({dbpath: dbpath});
let testDB = conn.getDB(jsTestName());
// This test should only be run with the flag enabled.
-assert(FeatureFlagUtil.isEnabled(testDB, "Telemetry"));
+assert(FeatureFlagUtil.isEnabled(testDB, "QueryStats"));
function testLower(restart = false) {
let adminDB = conn.getDB("admin");
@@ -26,7 +26,7 @@ function testLower(restart = false) {
}
assert.commandFailedWithCode(
- testDB.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}), 6579000);
+ testDB.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}}), 6579000);
// Upgrade FCV.
assert.commandWorked(adminDB.runCommand(
@@ -34,7 +34,7 @@ function testLower(restart = false) {
// We should be able to run a telemetry pipeline now that the FCV is correct.
assert.commandWorked(
- testDB.adminCommand({aggregate: 1, pipeline: [{$telemetry: {}}], cursor: {}}),
+ testDB.adminCommand({aggregate: 1, pipeline: [{$queryStats: {}}], cursor: {}}),
);
}
testLower(true);
diff --git a/jstests/noPassthrough/telemetry/redact_queries_with_nonobject_fields.js b/jstests/noPassthrough/queryStats/redact_queries_with_nonobject_fields.js
index 25cac47555e..7528ab9a4ab 100644
--- a/jstests/noPassthrough/telemetry/redact_queries_with_nonobject_fields.js
+++ b/jstests/noPassthrough/queryStats/redact_queries_with_nonobject_fields.js
@@ -1,6 +1,6 @@
/**
* Test that telemetry key generation works for queries with non-object fields.
- * @tags: [featureFlagTelemetry]
+ * @tags: [featureFlagQueryStats]
*/
load('jstests/libs/analyze_plan.js');
@@ -9,7 +9,7 @@ load('jstests/libs/analyze_plan.js');
// Turn on the collecting of telemetry metrics.
let options = {
- setParameter: {internalQueryConfigureTelemetrySamplingRate: -1},
+ setParameter: {internalQueryStatsSamplingRate: -1},
};
const conn = MongoRunner.runMongod(options);
diff --git a/jstests/noPassthroughWithMongod/telemetry_configuration.js b/jstests/noPassthroughWithMongod/query_stats_configuration.js
index 0ae4e8408c3..544fa63bc6d 100644
--- a/jstests/noPassthroughWithMongod/telemetry_configuration.js
+++ b/jstests/noPassthroughWithMongod/query_stats_configuration.js
@@ -7,7 +7,7 @@
load("jstests/libs/feature_flag_util.js");
-if (FeatureFlagUtil.isEnabled(db, "Telemetry")) {
+if (FeatureFlagUtil.isEnabled(db, "QueryStats")) {
function testTelemetrySetting(paramName, paramValue) {
// The feature flag is enabled - make sure the telemetry store can be configured.
const original = assert.commandWorked(db.adminCommand({getParameter: 1, [paramName]: 1}));
@@ -21,15 +21,13 @@ if (FeatureFlagUtil.isEnabled(db, "Telemetry")) {
db.adminCommand({setParameter: 1, [paramName]: originalValue}));
}
}
- testTelemetrySetting("internalQueryConfigureTelemetryCacheSize", "2MB");
- testTelemetrySetting("internalQueryConfigureTelemetrySamplingRate", 2147483647);
+ testTelemetrySetting("internalQueryStatsCacheSize", "2MB");
+ testTelemetrySetting("internalQueryStatsSamplingRate", 2147483647);
} else {
// The feature flag is disabled - make sure the telemetry store *cannot* be configured.
assert.commandFailedWithCode(
- db.adminCommand({setParameter: 1, internalQueryConfigureTelemetryCacheSize: '2MB'}),
- 7373500);
+ db.adminCommand({setParameter: 1, internalQueryStatsCacheSize: '2MB'}), 7373500);
assert.commandFailedWithCode(
- db.adminCommand({setParameter: 1, internalQueryConfigureTelemetrySamplingRate: 2147483647}),
- 7506200);
+ db.adminCommand({setParameter: 1, internalQueryStatsSamplingRate: 2147483647}), 7506200);
}
}());