summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/SConscript6
-rw-r--r--src/mongo/db/query/cqf_command_utils.cpp2
-rw-r--r--src/mongo/db/query/find.cpp6
-rw-r--r--src/mongo/db/query/find_request_shapifier.cpp12
-rw-r--r--src/mongo/db/query/find_request_shapifier.h11
-rw-r--r--src/mongo/db/query/query_feature_flags.idl6
-rw-r--r--src/mongo/db/query/query_knobs.idl28
-rw-r--r--src/mongo/db/query/query_shape.cpp2
-rw-r--r--src/mongo/db/query/query_shape.h2
-rw-r--r--src/mongo/db/query/request_shapifier.h20
-rw-r--r--src/mongo/db/query/telemetry.cpp (renamed from src/mongo/db/query/query_stats.cpp)248
-rw-r--r--src/mongo/db/query/telemetry.h (renamed from src/mongo/db/query/query_stats.h)82
-rw-r--r--src/mongo/db/query/telemetry_store_test.cpp (renamed from src/mongo/db/query/query_stats_store_test.cpp)99
-rw-r--r--src/mongo/db/query/telemetry_util.cpp (renamed from src/mongo/db/query/query_stats_util.cpp)18
-rw-r--r--src/mongo/db/query/telemetry_util.h (renamed from src/mongo/db/query/query_stats_util.h)26
15 files changed, 283 insertions, 285 deletions
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript
index 7f9e1c69a00..22e24674e1d 100644
--- a/src/mongo/db/query/SConscript
+++ b/src/mongo/db/query/SConscript
@@ -262,7 +262,7 @@ env.Library(
'query_feature_flags.idl',
'query_knobs.idl',
'sbe_plan_cache_on_parameter_change.cpp',
- 'query_stats_util.cpp',
+ 'telemetry_util.cpp',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/commands/test_commands_enabled',
@@ -366,7 +366,7 @@ env.Library(
target='op_metrics',
source=[
'query_shape.cpp',
- 'query_stats.cpp',
+ 'telemetry.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
@@ -448,7 +448,6 @@ env.CppUnitTest(
"query_settings_test.cpp",
"query_shape_test.cpp",
"query_shape_test.idl",
- "query_stats_store_test.cpp",
"query_solution_test.cpp",
"rate_limiting_test.cpp",
"sbe_and_hash_test.cpp",
@@ -462,6 +461,7 @@ env.CppUnitTest(
"sbe_stage_builder_type_checker_test.cpp",
"shard_filterer_factory_mock.cpp",
"sort_pattern_test.cpp",
+ "telemetry_store_test.cpp",
"util/memory_util_test.cpp",
"view_response_formatter_test.cpp",
'map_reduce_output_format_test.cpp',
diff --git a/src/mongo/db/query/cqf_command_utils.cpp b/src/mongo/db/query/cqf_command_utils.cpp
index 5db15a5ceee..a6279c43400 100644
--- a/src/mongo/db/query/cqf_command_utils.cpp
+++ b/src/mongo/db/query/cqf_command_utils.cpp
@@ -111,7 +111,6 @@
#include "mongo/db/pipeline/document_source_operation_metrics.h"
#include "mongo/db/pipeline/document_source_out.h"
#include "mongo/db/pipeline/document_source_plan_cache_stats.h"
-#include "mongo/db/pipeline/document_source_query_stats.h"
#include "mongo/db/pipeline/document_source_queue.h"
#include "mongo/db/pipeline/document_source_redact.h"
#include "mongo/db/pipeline/document_source_replace_root.h"
@@ -125,6 +124,7 @@
#include "mongo/db/pipeline/document_source_sort.h"
#include "mongo/db/pipeline/document_source_streaming_group.h"
#include "mongo/db/pipeline/document_source_tee_consumer.h"
+#include "mongo/db/pipeline/document_source_telemetry.h"
#include "mongo/db/pipeline/document_source_union_with.h"
#include "mongo/db/pipeline/document_source_unwind.h"
#include "mongo/db/pipeline/visitors/document_source_visitor_registry_mongod.h"
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index dcd402e9c70..c54138afd4b 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -112,7 +112,7 @@ void endQueryOp(OperationContext* opCtx,
auto curOp = CurOp::get(opCtx);
// Fill out basic CurOp query exec properties. More metrics (nreturned and executionTime)
- // are collected within collectQueryStatsMongod.
+ // are collected within collectTelemetryMongod.
curOp->debug().cursorid = (cursor.has_value() ? cursor->getCursor()->cursorid() : -1);
curOp->debug().cursorExhausted = !cursor.has_value();
curOp->debug().additiveMetrics.nBatches = 1;
@@ -125,9 +125,9 @@ void endQueryOp(OperationContext* opCtx,
curOp->setEndOfOpMetrics(numResults);
if (cursor) {
- collectQueryStatsMongod(opCtx, *cursor);
+ collectTelemetryMongod(opCtx, *cursor);
} else {
- collectQueryStatsMongod(opCtx, std::move(curOp->debug().queryStatsRequestShapifier));
+ collectTelemetryMongod(opCtx, std::move(curOp->debug().telemetryRequestShapifier));
}
if (collection) {
diff --git a/src/mongo/db/query/find_request_shapifier.cpp b/src/mongo/db/query/find_request_shapifier.cpp
index 83560f3acdb..8002a152a13 100644
--- a/src/mongo/db/query/find_request_shapifier.cpp
+++ b/src/mongo/db/query/find_request_shapifier.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/query/query_request_helper.h"
#include "mongo/db/query/query_shape.h"
-namespace mongo::query_stats {
+namespace mongo::telemetry {
void addNonShapeObjCmdLiterals(BSONObjBuilder* bob,
const FindCommandRequest& findCommand,
@@ -58,8 +58,8 @@ void addNonShapeObjCmdLiterals(BSONObjBuilder* bob,
}
-BSONObj FindRequestShapifier::makeQueryStatsKey(const SerializationOptions& opts,
- OperationContext* opCtx) const {
+BSONObj FindRequestShapifier::makeTelemetryKey(const SerializationOptions& opts,
+ OperationContext* opCtx) const {
auto expCtx = make_intrusive<ExpressionContext>(
opCtx, _request, nullptr /* collator doesn't matter here.*/, false /* mayDbProfile */);
expCtx->maxFeatureCompatibilityVersion = boost::none; // Ensure all features are allowed.
@@ -67,10 +67,10 @@ BSONObj FindRequestShapifier::makeQueryStatsKey(const SerializationOptions& opts
// expressions/stages, so it's a side effect tied to parsing. We must stop expression counters
// before re-parsing to avoid adding to the counters more than once per a given query.
expCtx->stopExpressionCounters();
- return makeQueryStatsKey(opts, expCtx);
+ return makeTelemetryKey(opts, expCtx);
}
-BSONObj FindRequestShapifier::makeQueryStatsKey(
+BSONObj FindRequestShapifier::makeTelemetryKey(
const SerializationOptions& opts, const boost::intrusive_ptr<ExpressionContext>& expCtx) const {
BSONObjBuilder bob;
@@ -102,4 +102,4 @@ BSONObj FindRequestShapifier::makeQueryStatsKey(
return bob.obj();
}
-} // namespace mongo::query_stats
+} // namespace mongo::telemetry
diff --git a/src/mongo/db/query/find_request_shapifier.h b/src/mongo/db/query/find_request_shapifier.h
index 79f8223052a..b03f84eb1ab 100644
--- a/src/mongo/db/query/find_request_shapifier.h
+++ b/src/mongo/db/query/find_request_shapifier.h
@@ -32,7 +32,7 @@
#include "mongo/db/query/find_command_gen.h"
#include "mongo/db/query/request_shapifier.h"
-namespace mongo::query_stats {
+namespace mongo::telemetry {
/**
* Handles shapification for FindCommandRequests.
@@ -49,13 +49,12 @@ public:
virtual ~FindRequestShapifier() = default;
- BSONObj makeQueryStatsKey(const SerializationOptions& opts,
- OperationContext* opCtx) const final;
+ BSONObj makeTelemetryKey(const SerializationOptions& opts, OperationContext* opCtx) const final;
- BSONObj makeQueryStatsKey(const SerializationOptions& opts,
- const boost::intrusive_ptr<ExpressionContext>& expCtx) const final;
+ BSONObj makeTelemetryKey(const SerializationOptions& opts,
+ const boost::intrusive_ptr<ExpressionContext>& expCtx) const final;
private:
FindCommandRequest _request;
};
-} // namespace mongo::query_stats
+} // namespace mongo::telemetry
diff --git a/src/mongo/db/query/query_feature_flags.idl b/src/mongo/db/query/query_feature_flags.idl
index e18477beb9c..cbd970ca47d 100644
--- a/src/mongo/db/query/query_feature_flags.idl
+++ b/src/mongo/db/query/query_feature_flags.idl
@@ -90,9 +90,9 @@ feature_flags:
default: false
shouldBeFCVGated: true
- featureFlagQueryStats:
- description: "Feature flag for enabling the queryStats store."
- cpp_varname: gFeatureFlagQueryStats
+ featureFlagTelemetry:
+ description: "Feature flag for enabling the telemetry store."
+ cpp_varname: gFeatureFlagTelemetry
default: false
shouldBeFCVGated: true
diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl
index 4fc1e362524..d631ab42d3d 100644
--- a/src/mongo/db/query/query_knobs.idl
+++ b/src/mongo/db/query/query_knobs.idl
@@ -36,7 +36,7 @@ global:
- "mongo/db/query/ce_mode_parameter.h"
- "mongo/db/query/explain_version_validator.h"
- "mongo/db/query/sbe_plan_cache_on_parameter_change.h"
- - "mongo/db/query/query_stats_util.h"
+ - "mongo/db/query/telemetry_util.h"
- "mongo/platform/atomic_proxy.h"
- "mongo/platform/atomic_word.h"
@@ -1018,32 +1018,32 @@ server_parameters:
default: false
test_only: true
- internalQueryStatsSamplingRate:
- description: "The maximum number of queries per second that are sampled for query stats.
+ internalQueryConfigureTelemetrySamplingRate:
+ description: "The maximum number of queries per second that are sampled for query telemetry.
If the rate of queries goes above this number, then rate limiting will kick in, and any
further queries will not be sampled. To sample all queries, this can be set to -1. This can be
- set to 0 to turn queryStats off completely."
+ set to 0 to turn telemetry off completely."
set_at: [ startup, runtime ]
- cpp_varname: "queryQueryStatsSamplingRate"
+ cpp_varname: "queryTelemetrySamplingRate"
cpp_vartype: AtomicWord<int>
default: 0
validator:
gte: -1
- on_update: query_stats_util::onQueryStatsSamplingRateUpdate
+ on_update: telemetry_util::onTelemetrySamplingRateUpdate
- internalQueryConfigureQueryStatsCacheSize:
- description: "The maximum amount of memory that the system will allocate for the query queryStats
+ internalQueryConfigureTelemetryCacheSize:
+ description: "The maximum amount of memory that the system will allocate for the query telemetry
cache. This will accept values in either of the following formats:
1. <number>% indicates a percentage of the physical memory available to the process. E.g.: 15%.
2. <number>(MB|GB), indicates the amount of memory in MB or GB. E.g.: 1.5GB, 100MB.
The default value is 1%, which means 1% of the physical memory available to the process."
set_at: [ startup, runtime ]
- cpp_varname: "queryQueryStatsStoreSize"
+ cpp_varname: "queryTelemetryStoreSize"
cpp_vartype: synchronized_value<std::string>
default: "1%"
- on_update: query_stats_util::onQueryStatsStoreSizeUpdate
+ on_update: telemetry_util::onTelemetryStoreSizeUpdate
validator:
- callback: query_stats_util::validateQueryStatsStoreSize
+ callback: telemetry_util::validateTelemetryStoreSize
internalQueryColumnScanMinCollectionSizeBytes:
description: "The min collection size threshold for which column scan will always be allowed. If
@@ -1130,7 +1130,7 @@ server_parameters:
default: 60000
validator:
gte: 0
-
+
internalQueryAggMulticastMaxConcurrency:
description: "Max number of concurrent requests when aggregations are sent to all shard servers"
set_at: startup
@@ -1173,8 +1173,8 @@ server_parameters:
gte: 0
internalQueryAutoParameterizationMaxParameterCount:
- description: "The maximum numbers of parameters that query auto-parameterization can extract from a query.
- If auto parameterizating a query would result in a greater number of parameters than the limit,
+ description: "The maximum numbers of parameters that query auto-parameterization can extract from a query.
+ If auto parameterizating a query would result in a greater number of parameters than the limit,
then auto parameterization will not be performed.
If set to 0, then no limit will be applied."
set_at: [ startup, runtime ]
diff --git a/src/mongo/db/query/query_shape.cpp b/src/mongo/db/query/query_shape.cpp
index 3f9ed7fbfb6..519b1115558 100644
--- a/src/mongo/db/query/query_shape.cpp
+++ b/src/mongo/db/query/query_shape.cpp
@@ -227,7 +227,7 @@ BSONObj extractQueryShape(const FindCommandRequest& findCommand,
expCtx,
ExtensionsCallbackNoop(),
MatchExpressionParser::kAllowAllSpecialFeatures),
- "Failed to parse 'filter' option when making queryStats key");
+ "Failed to parse 'filter' option when making telemetry key");
bob.append(FindCommandRequest::kFilterFieldName, filterExpr->serialize(opts));
}
diff --git a/src/mongo/db/query/query_shape.h b/src/mongo/db/query/query_shape.h
index c0d4328d08b..0fa0d7c863e 100644
--- a/src/mongo/db/query/query_shape.h
+++ b/src/mongo/db/query/query_shape.h
@@ -40,7 +40,7 @@ constexpr StringData kLiteralArgString = "?"_sd;
/**
* Computes a BSONObj that is meant to be used to classify queries according to their shape, for the
- * purposes of collecting queryStats.
+ * purposes of collecting telemetry.
*
* For example, if the MatchExpression represents {a: 2}, it will return the same BSONObj as the
* MatchExpression for {a: 1}, {a: 10}, and {a: {$eq: 2}} (identical bits but not sharing memory)
diff --git a/src/mongo/db/query/request_shapifier.h b/src/mongo/db/query/request_shapifier.h
index 37004197fd0..1bae8f913f9 100644
--- a/src/mongo/db/query/request_shapifier.h
+++ b/src/mongo/db/query/request_shapifier.h
@@ -34,27 +34,27 @@
#include "mongo/db/query/serialization_options.h"
#include "mongo/rpc/metadata/client_metadata.h"
-namespace mongo::query_stats {
+namespace mongo::telemetry {
/**
- * An abstract base class to handle query shapification for queryStats. Each request type should
- * define its own shapification strategy in its implementation of makeQueryStatsKey(), and then a
- * request should be registered with queryStats via query_stats::registerRequest(RequestShapifier).
+ * An abstract base class to handle query shapification for telemetry. Each request type should
+ * define its own shapification strategy in its implementation of makeTelemetryKey(), and then a
+ * request should be registered with telemetry via telemetry::registerRequest(RequestShapifier).
*/
class RequestShapifier {
public:
virtual ~RequestShapifier() = default;
/**
- * makeQueryStatsKey generates the telemetry key representative of the specific request's
+ * makeTelemetryKey generates the telemetry key representative of the specific request's
* payload. If there exists an ExpressionContext set up to parse and evaluate the request,
- * makeQueryStatsKey should be called with that ExpressionContext. If not, you can call the
+ * makeTelemetryKey should be called with that ExpressionContext. If not, you can call the
* overload that accepts the OperationContext and will construct a minimally-acceptable
* ExpressionContext for the sake of generating the key.
*/
- virtual BSONObj makeQueryStatsKey(const SerializationOptions& opts,
- OperationContext* opCtx) const = 0;
- virtual BSONObj makeQueryStatsKey(
+ virtual BSONObj makeTelemetryKey(const SerializationOptions& opts,
+ OperationContext* opCtx) const = 0;
+ virtual BSONObj makeTelemetryKey(
const SerializationOptions& opts,
const boost::intrusive_ptr<ExpressionContext>& expCtx) const = 0;
@@ -79,4 +79,4 @@ protected:
BSONObj _commentObj;
boost::optional<BSONElement> _comment = boost::none;
};
-} // namespace mongo::query_stats
+} // namespace mongo::telemetry
diff --git a/src/mongo/db/query/query_stats.cpp b/src/mongo/db/query/telemetry.cpp
index 6b99a43fc3f..af17da7af02 100644
--- a/src/mongo/db/query/query_stats.cpp
+++ b/src/mongo/db/query/telemetry.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#include "mongo/db/query/query_stats.h"
+#include "mongo/db/query/telemetry.h"
#include "mongo/crypto/hash_block.h"
#include "mongo/crypto/sha256_block.h"
@@ -45,10 +45,10 @@
#include "mongo/db/query/query_feature_flags_gen.h"
#include "mongo/db/query/query_planner_params.h"
#include "mongo/db/query/query_request_helper.h"
-#include "mongo/db/query/query_stats_util.h"
#include "mongo/db/query/rate_limiting.h"
#include "mongo/db/query/serialization_options.h"
#include "mongo/db/query/sort_pattern.h"
+#include "mongo/db/query/telemetry_util.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/metadata/client_metadata.h"
#include "mongo/util/assert_util.h"
@@ -62,7 +62,7 @@
namespace mongo {
-namespace query_stats {
+namespace telemetry {
/**
* Redacts all BSONObj field names as if they were paths, unless the field name is a special hint
@@ -78,63 +78,63 @@ boost::optional<std::string> getApplicationName(const OperationContext* opCtx) {
}
} // namespace
-CounterMetric queryStatsStoreSizeEstimateBytesMetric("queryStats.queryStatsStoreSizeEstimateBytes");
+CounterMetric telemetryStoreSizeEstimateBytesMetric("telemetry.telemetryStoreSizeEstimateBytes");
namespace {
-CounterMetric queryStatsEvictedMetric("queryStats.numEvicted");
-CounterMetric queryStatsRateLimitedRequestsMetric("queryStats.numRateLimitedRequests");
-CounterMetric queryStatsStoreWriteErrorsMetric("queryStats.numQueryStatsStoreWriteErrors");
+CounterMetric telemetryEvictedMetric("telemetry.numEvicted");
+CounterMetric telemetryRateLimitedRequestsMetric("telemetry.numRateLimitedRequests");
+CounterMetric telemetryStoreWriteErrorsMetric("telemetry.numTelemetryStoreWriteErrors");
/**
- * Cap the queryStats store size.
+ * Cap the telemetry store size.
*/
-size_t capQueryStatsStoreSize(size_t requestedSize) {
+size_t capTelemetryStoreSize(size_t requestedSize) {
size_t cappedStoreSize = memory_util::capMemorySize(
requestedSize /*requestedSizeBytes*/, 1 /*maximumSizeGB*/, 25 /*percentTotalSystemMemory*/);
- // If capped size is less than requested size, the queryStats store has been capped at its
+ // If capped size is less than requested size, the telemetry store has been capped at its
// upper limit.
if (cappedStoreSize < requestedSize) {
LOGV2_DEBUG(7106502,
1,
- "The queryStats store size has been capped",
+ "The telemetry store size has been capped",
"cappedSize"_attr = cappedStoreSize);
}
return cappedStoreSize;
}
/**
- * Get the queryStats store size based on the query job's value.
+ * Get the telemetry store size based on the query job's value.
*/
-size_t getQueryStatsStoreSize() {
- auto status = memory_util::MemorySize::parse(queryQueryStatsStoreSize.get());
+size_t getTelemetryStoreSize() {
+ auto status = memory_util::MemorySize::parse(queryTelemetryStoreSize.get());
uassertStatusOK(status);
size_t requestedSize = memory_util::convertToSizeInBytes(status.getValue());
- return capQueryStatsStoreSize(requestedSize);
+ return capTelemetryStoreSize(requestedSize);
}
/**
- * A manager for the queryStats store allows a "pointer swap" on the queryStats store itself. The
+ * A manager for the telemetry store allows a "pointer swap" on the telemetry store itself. The
* usage patterns are as follows:
*
- * - Updating the queryStats store uses the `getQueryStatsStore()` method. The queryStats store
+ * - Updating the telemetry store uses the `getTelemetryStore()` method. The telemetry store
* instance is obtained, entries are looked up and mutated, or created anew.
- * - The queryStats store is "reset". This involves atomically allocating a new instance, once
+ * - The telemetry store is "reset". This involves atomically allocating a new instance, once
* there are no more updaters (readers of the store "pointer"), and returning the existing
* instance.
*/
-class QueryStatsStoreManager {
+class TelemetryStoreManager {
public:
- template <typename... QueryStatsStoreArgs>
- QueryStatsStoreManager(size_t cacheSize, size_t numPartitions)
- : _queryStatsStore(std::make_unique<QueryStatsStore>(cacheSize, numPartitions)),
+ template <typename... TelemetryStoreArgs>
+ TelemetryStoreManager(size_t cacheSize, size_t numPartitions)
+ : _telemetryStore(std::make_unique<TelemetryStore>(cacheSize, numPartitions)),
_maxSize(cacheSize) {}
/**
- * Acquire the instance of the queryStats store.
+ * Acquire the instance of the telemetry store.
*/
- QueryStatsStore& getQueryStatsStore() {
- return *_queryStatsStore;
+ TelemetryStore& getTelemetryStore() {
+ return *_telemetryStore;
}
size_t getMaxSize() {
@@ -142,93 +142,92 @@ public:
}
/**
- * Resize the queryStats store and return the number of evicted
+ * Resize the telemetry store and return the number of evicted
* entries.
*/
size_t resetSize(size_t cacheSize) {
_maxSize = cacheSize;
- return _queryStatsStore->reset(cacheSize);
+ return _telemetryStore->reset(cacheSize);
}
private:
- std::unique_ptr<QueryStatsStore> _queryStatsStore;
+ std::unique_ptr<TelemetryStore> _telemetryStore;
/**
- * Max size of the queryStats store. Tracked here to avoid having to recompute after it's
- * divided up into partitions.
+ * Max size of the telemetry store. Tracked here to avoid having to recompute after it's divided
+ * up into partitions.
*/
size_t _maxSize;
};
-const auto queryStatsStoreDecoration =
- ServiceContext::declareDecoration<std::unique_ptr<QueryStatsStoreManager>>();
+const auto telemetryStoreDecoration =
+ ServiceContext::declareDecoration<std::unique_ptr<TelemetryStoreManager>>();
-const auto queryStatsRateLimiter =
+const auto telemetryRateLimiter =
ServiceContext::declareDecoration<std::unique_ptr<RateLimiting>>();
-class TelemetryOnParamChangeUpdaterImpl final : public query_stats_util::OnParamChangeUpdater {
+class TelemetryOnParamChangeUpdaterImpl final : public telemetry_util::OnParamChangeUpdater {
public:
void updateCacheSize(ServiceContext* serviceCtx, memory_util::MemorySize memSize) final {
auto requestedSize = memory_util::convertToSizeInBytes(memSize);
- auto cappedSize = capQueryStatsStoreSize(requestedSize);
- auto& queryStatsStoreManager = queryStatsStoreDecoration(serviceCtx);
- size_t numEvicted = queryStatsStoreManager->resetSize(cappedSize);
- queryStatsEvictedMetric.increment(numEvicted);
+ auto cappedSize = capTelemetryStoreSize(requestedSize);
+ auto& telemetryStoreManager = telemetryStoreDecoration(serviceCtx);
+ size_t numEvicted = telemetryStoreManager->resetSize(cappedSize);
+ telemetryEvictedMetric.increment(numEvicted);
}
void updateSamplingRate(ServiceContext* serviceCtx, int samplingRate) {
- queryStatsRateLimiter(serviceCtx).get()->setSamplingRate(samplingRate);
+ telemetryRateLimiter(serviceCtx).get()->setSamplingRate(samplingRate);
}
};
-ServiceContext::ConstructorActionRegisterer queryStatsStoreManagerRegisterer{
- "QueryStatsStoreManagerRegisterer", [](ServiceContext* serviceCtx) {
+ServiceContext::ConstructorActionRegisterer telemetryStoreManagerRegisterer{
+ "TelemetryStoreManagerRegisterer", [](ServiceContext* serviceCtx) {
// It is possible that this is called before FCV is properly set up. Setting up the store if
// the flag is enabled but FCV is incorrect is safe, and guards against the FCV being
// changed to a supported version later.
- if (!feature_flags::gFeatureFlagQueryStats.isEnabledAndIgnoreFCVUnsafeAtStartup()) {
+ if (!feature_flags::gFeatureFlagTelemetry.isEnabledAndIgnoreFCVUnsafeAtStartup()) {
// featureFlags are not allowed to be changed at runtime. Therefore it's not an issue
- // to not create a queryStats store in ConstructorActionRegisterer at start up with the
+ // to not create a telemetry store in ConstructorActionRegisterer at start up with the
// flag off - because the flag can not be turned on at any point afterwards.
- query_stats_util::queryStatsStoreOnParamChangeUpdater(serviceCtx) =
- std::make_unique<query_stats_util::NoChangesAllowedTelemetryParamUpdater>();
+ telemetry_util::telemetryStoreOnParamChangeUpdater(serviceCtx) =
+ std::make_unique<telemetry_util::NoChangesAllowedTelemetryParamUpdater>();
return;
}
- query_stats_util::queryStatsStoreOnParamChangeUpdater(serviceCtx) =
+ telemetry_util::telemetryStoreOnParamChangeUpdater(serviceCtx) =
std::make_unique<TelemetryOnParamChangeUpdaterImpl>();
- size_t size = getQueryStatsStoreSize();
- auto&& globalQueryStatsStoreManager = queryStatsStoreDecoration(serviceCtx);
- // The plan cache and queryStats store should use the same number of partitions.
+ size_t size = getTelemetryStoreSize();
+ auto&& globalTelemetryStoreManager = telemetryStoreDecoration(serviceCtx);
+ // The plan cache and telemetry store should use the same number of partitions.
// That is, the number of cpu cores.
size_t numPartitions = ProcessInfo::getNumCores();
size_t partitionBytes = size / numPartitions;
- size_t metricsSize = sizeof(QueryStatsEntry);
+ size_t metricsSize = sizeof(TelemetryEntry);
if (partitionBytes < metricsSize * 10) {
numPartitions = size / metricsSize;
if (numPartitions < 1) {
numPartitions = 1;
}
}
- globalQueryStatsStoreManager =
- std::make_unique<QueryStatsStoreManager>(size, numPartitions);
- auto configuredSamplingRate = queryQueryStatsSamplingRate.load();
- queryStatsRateLimiter(serviceCtx) = std::make_unique<RateLimiting>(
+ globalTelemetryStoreManager = std::make_unique<TelemetryStoreManager>(size, numPartitions);
+ auto configuredSamplingRate = queryTelemetrySamplingRate.load();
+ telemetryRateLimiter(serviceCtx) = std::make_unique<RateLimiting>(
configuredSamplingRate < 0 ? INT_MAX : configuredSamplingRate);
}};
/**
- * Top-level checks for whether queryStats collection is enabled. If this returns false, we must go
+ * Top-level checks for whether telemetry collection is enabled. If this returns false, we must go
* no further.
*/
-bool isQueryStatsEnabled(const ServiceContext* serviceCtx) {
+bool isTelemetryEnabled(const ServiceContext* serviceCtx) {
// During initialization FCV may not yet be setup but queries could be run. We can't
- // check whether queryStats should be enabled without FCV, so default to not recording
+ // check whether telemetry should be enabled without FCV, so default to not recording
// those queries.
// TODO SERVER-75935 Remove FCV Check.
- return feature_flags::gFeatureFlagQueryStats.isEnabled(
+ return feature_flags::gFeatureFlagTelemetry.isEnabled(
serverGlobalParams.featureCompatibility) &&
- queryStatsStoreDecoration(serviceCtx)->getMaxSize() > 0;
+ telemetryStoreDecoration(serviceCtx)->getMaxSize() > 0;
}
/**
@@ -236,26 +235,26 @@ bool isQueryStatsEnabled(const ServiceContext* serviceCtx) {
* configuration for a global on/off decision and, if enabled, delegates to the rate limiter.
*/
bool shouldCollect(const ServiceContext* serviceCtx) {
- // Quick escape if queryStats is turned off.
- if (!isQueryStatsEnabled(serviceCtx)) {
+ // Quick escape if telemetry is turned off.
+ if (!isTelemetryEnabled(serviceCtx)) {
return false;
}
- // Cannot collect queryStats if sampling rate is not greater than 0. Note that we do not
- // increment queryStatsRateLimitedRequestsMetric here since queryStats is entirely disabled.
- if (queryStatsRateLimiter(serviceCtx)->getSamplingRate() <= 0) {
+ // Cannot collect telemetry if sampling rate is not greater than 0. Note that we do not
+ // increment telemetryRateLimitedRequestsMetric here since telemetry is entirely disabled.
+ if (telemetryRateLimiter(serviceCtx)->getSamplingRate() <= 0) {
return false;
}
- // Check if rate limiting allows us to collect queryStats for this request.
- if (queryStatsRateLimiter(serviceCtx)->getSamplingRate() < INT_MAX &&
- !queryStatsRateLimiter(serviceCtx)->handleRequestSlidingWindow()) {
- queryStatsRateLimitedRequestsMetric.increment();
+ // Check if rate limiting allows us to collect telemetry for this request.
+ if (telemetryRateLimiter(serviceCtx)->getSamplingRate() < INT_MAX &&
+ !telemetryRateLimiter(serviceCtx)->handleRequestSlidingWindow()) {
+ telemetryRateLimitedRequestsMetric.increment();
return false;
}
return true;
}
/**
- * Add a field to the find op's queryStats key. The `value` will have hmac applied.
+ * Add a field to the find op's telemetry key. The `value` will have hmac applied.
*/
void addToFindKey(BSONObjBuilder& builder, const StringData& fieldName, const BSONObj& value) {
serializeBSONWhenNotEmpty(value.redact(false), fieldName, &builder);
@@ -289,7 +288,7 @@ void throwIfEncounteringFLEPayload(const BSONElement& e) {
/**
* Upon reading telemetry data, we apply hmac to some keys. This is the list. See
- * QueryStatsEntry::makeQueryStatsKey().
+ * TelemetryEntry::makeTelemetryKey().
*/
const stdx::unordered_set<std::string> kKeysToApplyHmac = {"pipeline", "find"};
@@ -310,7 +309,7 @@ std::string constantFieldNameHasher(const BSONElement& e) {
/**
* Admittedly an abuse of the BSON redaction interface, we recognize FLE payloads here and avoid
- * collecting queryStats for the query.
+ * collecting telemetry for the query.
*/
std::string fleSafeFieldNameRedactor(const BSONElement& e) {
throwIfEncounteringFLEPayload(e);
@@ -345,9 +344,9 @@ std::size_t hash(const BSONObj& obj) {
} // namespace
-BSONObj QueryStatsEntry::computeQueryStatsKey(OperationContext* opCtx,
- bool applyHmacToIdentifiers,
- std::string hmacKey) const {
+BSONObj TelemetryEntry::computeTelemetryKey(OperationContext* opCtx,
+ bool applyHmacToIdentifiers,
+ std::string hmacKey) const {
// The telemetry key for find queries is generated by serializing all the command fields
// and applying hmac if SerializationOptions indicate to do so. The resulting key is of the
// form:
@@ -370,7 +369,7 @@ BSONObj QueryStatsEntry::computeQueryStatsKey(OperationContext* opCtx,
[&](StringData sd) { return sha256HmacStringDataHasher(hmacKey, sd); },
LiteralSerializationPolicy::kToDebugTypeString)
: SerializationOptions(LiteralSerializationPolicy::kToDebugTypeString);
- return requestShapifier->makeQueryStatsKey(serializationOpts, opCtx);
+ return requestShapifier->makeTelemetryKey(serializationOpts, opCtx);
}
// TODO SERVER-73152 remove all special aggregation logic below
@@ -378,7 +377,7 @@ BSONObj QueryStatsEntry::computeQueryStatsKey(OperationContext* opCtx,
// { "agg": {...}, "namespace": "...", "applicationName": "...", ... }
//
// The part of the key we need to apply hmac to is the object in the <CMD_TYPE> element. In the
- // case of an aggregate() command, it will look something like: > "pipeline" : [ { "$queryStats"
+ // case of an aggregate() command, it will look something like: > "pipeline" : [ { "$telemetry"
// : {} },
// { "$addFields" : { "x" : { "$someExpr" {} } } } ],
// We should preserve the top-level stage names in the pipeline but apply hmac to all field
@@ -386,10 +385,10 @@ BSONObj QueryStatsEntry::computeQueryStatsKey(OperationContext* opCtx,
// TODO: SERVER-73152 literal and field name redaction for aggregate command.
if (!applyHmacToIdentifiers) {
- return oldQueryStatsKey;
+ return oldTelemetryKey;
}
BSONObjBuilder hmacAppliedBuilder;
- for (BSONElement e : oldQueryStatsKey) {
+ for (BSONElement e : oldTelemetryKey) {
if ((e.type() == Object || e.type() == Array) &&
kKeysToApplyHmac.count(e.fieldNameStringData().toString()) == 1) {
auto hmacApplicator = [&](BSONObjBuilder subObj, const BSONObj& obj) {
@@ -424,24 +423,25 @@ BSONObj QueryStatsEntry::computeQueryStatsKey(OperationContext* opCtx,
}
// The originating command/query does not persist through the end of query execution. In order to
-// pair the queryStats metrics that are collected at the end of execution with the original query,
-// it is necessary to register the original query during planning and persist it after execution.
+// pair the telemetry metrics that are collected at the end of execution with the original query, it
+// is necessary to register the original query during planning and persist it after
+// execution.
// During planning, registerRequest is called to serialize the query shape and context (together,
-// the queryStats context) and save it to OpDebug. Moreover, as query execution may span more than
+// the telemetry context) and save it to OpDebug. Moreover, as query execution may span more than
// one request/operation and OpDebug does not persist through cursor iteration, it is necessary to
-// communicate the queryStats context across operations. In this way, the queryStats context is
-// registered to the cursor, so upon getMore() calls, the cursor manager passes the queryStats key
+// communicate the telemetry context across operations. In this way, the telemetry context is
+// registered to the cursor, so upon getMore() calls, the cursor manager passes the telemetry key
// from the pinned cursor to the new OpDebug.
-// Once query execution is complete, the queryStats context is grabbed from OpDebug, a queryStats
-// key is generated from this and metrics are paired to this key in the queryStats store.
+// Once query execution is complete, the telemetry context is grabbed from OpDebug, a telemetry key
+// is generated from this and metrics are paired to this key in the telemetry store.
void registerAggRequest(const AggregateCommandRequest& request, OperationContext* opCtx) {
- if (!isQueryStatsEnabled(opCtx->getServiceContext())) {
+ if (!isTelemetryEnabled(opCtx->getServiceContext())) {
return;
}
- // Queries against metadata collections should never appear in queryStats data.
+ // Queries against metadata collections should never appear in telemetry data.
if (request.getNamespace().isFLE2StateCollection()) {
return;
}
@@ -450,8 +450,8 @@ void registerAggRequest(const AggregateCommandRequest& request, OperationContext
return;
}
- BSONObjBuilder queryStatsKey;
- BSONObjBuilder pipelineBuilder = queryStatsKey.subarrayStart("pipeline"_sd);
+ BSONObjBuilder telemetryKey;
+ BSONObjBuilder pipelineBuilder = telemetryKey.subarrayStart("pipeline"_sd);
try {
for (auto&& stage : request.getPipeline()) {
BSONObjBuilder stageBuilder = pipelineBuilder.subobjStart("stage"_sd);
@@ -459,31 +459,31 @@ void registerAggRequest(const AggregateCommandRequest& request, OperationContext
stageBuilder.done();
}
pipelineBuilder.done();
- queryStatsKey.append("namespace", request.getNamespace().toString());
+ telemetryKey.append("namespace", request.getNamespace().toString());
if (request.getReadConcern()) {
- queryStatsKey.append("readConcern", *request.getReadConcern());
+ telemetryKey.append("readConcern", *request.getReadConcern());
}
if (auto metadata = ClientMetadata::get(opCtx->getClient())) {
- queryStatsKey.append("applicationName", metadata->getApplicationName());
+ telemetryKey.append("applicationName", metadata->getApplicationName());
}
} catch (ExceptionFor<ErrorCodes::EncounteredFLEPayloadWhileApplyingHmac>&) {
return;
}
- BSONObj key = queryStatsKey.obj();
- CurOp::get(opCtx)->debug().queryStatsStoreKeyHash = hash(key);
- CurOp::get(opCtx)->debug().queryStatsStoreKey = key.getOwned();
+ BSONObj key = telemetryKey.obj();
+ CurOp::get(opCtx)->debug().telemetryStoreKeyHash = hash(key);
+ CurOp::get(opCtx)->debug().telemetryStoreKey = key.getOwned();
}
void registerRequest(std::unique_ptr<RequestShapifier> requestShapifier,
const NamespaceString& collection,
OperationContext* opCtx,
const boost::intrusive_ptr<ExpressionContext>& expCtx) {
- if (!isQueryStatsEnabled(opCtx->getServiceContext())) {
+ if (!isTelemetryEnabled(opCtx->getServiceContext())) {
return;
}
- // Queries against metadata collections should never appear in queryStats data.
+ // Queries against metadata collections should never appear in telemetry data.
if (collection.isFLE2StateCollection()) {
return;
}
@@ -494,53 +494,53 @@ void registerRequest(std::unique_ptr<RequestShapifier> requestShapifier,
SerializationOptions options;
options.literalPolicy = LiteralSerializationPolicy::kToDebugTypeString;
options.replacementForLiteralArgs = replacementForLiteralArgs;
- CurOp::get(opCtx)->debug().queryStatsStoreKeyHash =
- hash(requestShapifier->makeQueryStatsKey(options, expCtx));
- CurOp::get(opCtx)->debug().queryStatsRequestShapifier = std::move(requestShapifier);
+ CurOp::get(opCtx)->debug().telemetryStoreKeyHash =
+ hash(requestShapifier->makeTelemetryKey(options, expCtx));
+ CurOp::get(opCtx)->debug().telemetryRequestShapifier = std::move(requestShapifier);
}
-QueryStatsStore& getQueryStatsStore(OperationContext* opCtx) {
+TelemetryStore& getTelemetryStore(OperationContext* opCtx) {
uassert(6579000,
"Telemetry is not enabled without the feature flag on and a cache size greater than 0 "
"bytes",
- isQueryStatsEnabled(opCtx->getServiceContext()));
- return queryStatsStoreDecoration(opCtx->getServiceContext())->getQueryStatsStore();
+ isTelemetryEnabled(opCtx->getServiceContext()));
+ return telemetryStoreDecoration(opCtx->getServiceContext())->getTelemetryStore();
}
-void writeQueryStats(OperationContext* opCtx,
- boost::optional<size_t> queryStatsKeyHash,
- boost::optional<BSONObj> queryStatsKey,
- std::unique_ptr<RequestShapifier> requestShapifier,
- const uint64_t queryExecMicros,
- const uint64_t docsReturned) {
- if (!queryStatsKeyHash) {
+void writeTelemetry(OperationContext* opCtx,
+ boost::optional<size_t> telemetryKeyHash,
+ boost::optional<BSONObj> telemetryKey,
+ std::unique_ptr<RequestShapifier> requestShapifier,
+ const uint64_t queryExecMicros,
+ const uint64_t docsReturned) {
+ if (!telemetryKeyHash) {
return;
}
- auto&& queryStatsStore = getQueryStatsStore(opCtx);
+ auto&& telemetryStore = getTelemetryStore(opCtx);
auto&& [statusWithMetrics, partitionLock] =
- queryStatsStore.getWithPartitionLock(*queryStatsKeyHash);
- std::shared_ptr<QueryStatsEntry> metrics;
+ telemetryStore.getWithPartitionLock(*telemetryKeyHash);
+ std::shared_ptr<TelemetryEntry> metrics;
if (statusWithMetrics.isOK()) {
metrics = *statusWithMetrics.getValue();
} else {
- BSONObj key = queryStatsKey.value_or(BSONObj{});
+ BSONObj key = telemetryKey.value_or(BSONObj{});
size_t numEvicted =
- queryStatsStore.put(*queryStatsKeyHash,
- std::make_shared<QueryStatsEntry>(
- std::move(requestShapifier), CurOp::get(opCtx)->getNSS(), key),
- partitionLock);
- queryStatsEvictedMetric.increment(numEvicted);
- auto newMetrics = partitionLock->get(*queryStatsKeyHash);
+ telemetryStore.put(*telemetryKeyHash,
+ std::make_shared<TelemetryEntry>(
+ std::move(requestShapifier), CurOp::get(opCtx)->getNSS(), key),
+ partitionLock);
+ telemetryEvictedMetric.increment(numEvicted);
+ auto newMetrics = partitionLock->get(*telemetryKeyHash);
if (!newMetrics.isOK()) {
// This can happen if the budget is immediately exceeded. Specifically if the there is
// not enough room for a single new entry if the number of partitions is too high
// relative to the size.
- queryStatsStoreWriteErrorsMetric.increment();
+ telemetryStoreWriteErrorsMetric.increment();
LOGV2_DEBUG(7560900,
1,
- "Failed to store queryStats entry.",
+ "Failed to store telemetry entry.",
"status"_attr = newMetrics.getStatus(),
- "queryStatsKeyHash"_attr = queryStatsKeyHash);
+ "telemetryKeyHash"_attr = telemetryKeyHash);
return;
}
metrics = newMetrics.getValue()->second;
@@ -551,5 +551,5 @@ void writeQueryStats(OperationContext* opCtx,
metrics->queryExecMicros.aggregate(queryExecMicros);
metrics->docsReturned.aggregate(docsReturned);
}
-} // namespace query_stats
+} // namespace telemetry
} // namespace mongo
diff --git a/src/mongo/db/query/query_stats.h b/src/mongo/db/query/telemetry.h
index 59d79d6c114..e7e0f3ccfd1 100644
--- a/src/mongo/db/query/query_stats.h
+++ b/src/mongo/db/query/telemetry.h
@@ -55,7 +55,7 @@ namespace {
using BSONNumeric = long long;
} // namespace
-namespace query_stats {
+namespace telemetry {
/**
* An aggregated metric stores a compressed view of data. It balances the loss of information
@@ -95,26 +95,26 @@ struct AggregatedMetric {
uint64_t sumOfSquares = 0;
};
-extern CounterMetric queryStatsStoreSizeEstimateBytesMetric;
+extern CounterMetric telemetryStoreSizeEstimateBytesMetric;
// Used to aggregate the metrics for one telemetry key over all its executions.
-class QueryStatsEntry {
+class TelemetryEntry {
public:
- QueryStatsEntry(std::unique_ptr<RequestShapifier> requestShapifier,
- NamespaceStringOrUUID nss,
- const BSONObj& cmdObj)
+ TelemetryEntry(std::unique_ptr<RequestShapifier> requestShapifier,
+ NamespaceStringOrUUID nss,
+ const BSONObj& cmdObj)
: firstSeenTimestamp(Date_t::now().toMillisSinceEpoch() / 1000, 0),
requestShapifier(std::move(requestShapifier)),
nss(nss),
- oldQueryStatsKey(cmdObj.copy()) {
- queryStatsStoreSizeEstimateBytesMetric.increment(sizeof(QueryStatsEntry) + sizeof(BSONObj));
+ oldTelemetryKey(cmdObj.copy()) {
+ telemetryStoreSizeEstimateBytesMetric.increment(sizeof(TelemetryEntry) + sizeof(BSONObj));
}
- ~QueryStatsEntry() {
- queryStatsStoreSizeEstimateBytesMetric.decrement(sizeof(QueryStatsEntry) + sizeof(BSONObj));
+ ~TelemetryEntry() {
+ telemetryStoreSizeEstimateBytesMetric.decrement(sizeof(TelemetryEntry) + sizeof(BSONObj));
}
BSONObj toBSON() const {
- BSONObjBuilder builder{sizeof(QueryStatsEntry) + 100};
+ BSONObjBuilder builder{sizeof(TelemetryEntry) + 100};
builder.append("lastExecutionMicros", (BSONNumeric)lastExecutionMicros);
builder.append("execCount", (BSONNumeric)execCount);
queryExecMicros.appendTo(builder, "queryExecMicros");
@@ -124,11 +124,11 @@ public:
}
/**
- * Redact a given queryStats key and set _keySize.
+ * Redact a given telemetry key and set _keySize.
*/
- BSONObj computeQueryStatsKey(OperationContext* opCtx,
- bool applyHmacToIdentifiers,
- std::string hmacKey) const;
+ BSONObj computeTelemetryKey(OperationContext* opCtx,
+ bool applyHmacToIdentifiers,
+ std::string hmacKey) const;
/**
* Timestamp for when this query shape was added to the store. Set on construction.
@@ -153,8 +153,8 @@ public:
NamespaceStringOrUUID nss;
- // TODO: SERVER-73152 remove oldQueryStatsKey when RequestShapifier is used for agg.
- BSONObj oldQueryStatsKey;
+ // TODO: SERVER-73152 remove oldTelemetryKey when RequestShapifier is used for agg.
+ BSONObj oldTelemetryKey;
};
struct TelemetryPartitioner {
@@ -164,32 +164,32 @@ struct TelemetryPartitioner {
}
};
-struct QueryStatsStoreEntryBudgetor {
- size_t operator()(const std::size_t key, const std::shared_ptr<QueryStatsEntry>& value) {
+struct TelemetryStoreEntryBudgetor {
+ size_t operator()(const std::size_t key, const std::shared_ptr<TelemetryEntry>& value) {
// The buget estimator for <key,value> pair in LRU cache accounts for the size of the key
// and the size of the metrics, including the bson object used for generating the telemetry
// key at read time.
- return sizeof(QueryStatsEntry) + sizeof(std::size_t) + value->oldQueryStatsKey.objsize();
+ return sizeof(TelemetryEntry) + sizeof(std::size_t) + value->oldTelemetryKey.objsize();
}
};
-using QueryStatsStore = PartitionedCache<std::size_t,
- std::shared_ptr<QueryStatsEntry>,
- QueryStatsStoreEntryBudgetor,
- TelemetryPartitioner>;
+using TelemetryStore = PartitionedCache<std::size_t,
+ std::shared_ptr<TelemetryEntry>,
+ TelemetryStoreEntryBudgetor,
+ TelemetryPartitioner>;
/**
- * Acquire a reference to the global queryStats store.
+ * Acquire a reference to the global telemetry store.
*/
-QueryStatsStore& getQueryStatsStore(OperationContext* opCtx);
+TelemetryStore& getTelemetryStore(OperationContext* opCtx);
/**
- * Register a request for queryStats collection. The queryStats machinery may decide not to
+ * Register a request for telemetry collection. The telemetry machinery may decide not to
* collect anything but this should be called for all requests. The decision is made based on
- * the feature flag and queryStats parameters such as rate limiting.
+ * the feature flag and telemetry parameters such as rate limiting.
*
- * The caller is still responsible for subsequently calling writeQueryStats() once the request is
+ * The caller is still responsible for subsequently calling writeTelemetry() once the request is
* completed.
*
* Note that calling this affects internal state. It should be called once for each request for
@@ -203,22 +203,22 @@ void registerRequest(std::unique_ptr<RequestShapifier> requestShapifier,
const boost::intrusive_ptr<ExpressionContext>& expCtx);
/**
- * Writes queryStats to the queryStats store for the operation identified by `queryStatsKey`.
+ * Writes telemetry to the telemetry store for the operation identified by `telemetryKey`.
*/
-void writeQueryStats(OperationContext* opCtx,
- boost::optional<size_t> queryStatsKeyHash,
- boost::optional<BSONObj> queryStatsKey,
- std::unique_ptr<RequestShapifier> requestShapifier,
- uint64_t queryExecMicros,
- uint64_t docsReturned);
+void writeTelemetry(OperationContext* opCtx,
+ boost::optional<size_t> telemetryKeyHash,
+ boost::optional<BSONObj> telemetryKey,
+ std::unique_ptr<RequestShapifier> requestShapifier,
+ uint64_t queryExecMicros,
+ uint64_t docsReturned);
/**
* Serialize the FindCommandRequest according to the Options passed in. Returns the serialized BSON
* with hmac applied to all field names and literals.
*/
-BSONObj makeQueryStatsKey(const FindCommandRequest& findCommand,
- const SerializationOptions& opts,
- const boost::intrusive_ptr<ExpressionContext>& expCtx,
- boost::optional<const QueryStatsEntry&> existingMetrics = boost::none);
-} // namespace query_stats
+BSONObj makeTelemetryKey(const FindCommandRequest& findCommand,
+ const SerializationOptions& opts,
+ const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ boost::optional<const TelemetryEntry&> existingMetrics = boost::none);
+} // namespace telemetry
} // namespace mongo
diff --git a/src/mongo/db/query/query_stats_store_test.cpp b/src/mongo/db/query/telemetry_store_test.cpp
index e36ac7ccd98..8d68ee566c6 100644
--- a/src/mongo/db/query/query_stats_store_test.cpp
+++ b/src/mongo/db/query/telemetry_store_test.cpp
@@ -33,13 +33,13 @@
#include "mongo/db/pipeline/expression_context_for_test.h"
#include "mongo/db/query/find_request_shapifier.h"
#include "mongo/db/query/query_feature_flags_gen.h"
-#include "mongo/db/query/query_stats.h"
+#include "mongo/db/query/telemetry.h"
#include "mongo/db/service_context_test_fixture.h"
#include "mongo/idl/server_parameter_test_util.h"
#include "mongo/unittest/inline_auto_update.h"
#include "mongo/unittest/unittest.h"
-namespace mongo::query_stats {
+namespace mongo::telemetry {
/**
* A default hmac application strategy that generates easy to check results for testing purposes.
*/
@@ -51,9 +51,9 @@ std::size_t hash(const BSONObj& obj) {
return absl::hash_internal::CityHash64(obj.objdata(), obj.objsize());
}
-class QueryStatsStoreTest : public ServiceContextTest {
+class TelemetryStoreTest : public ServiceContextTest {
public:
- BSONObj makeQueryStatsKeyFindRequest(
+ BSONObj makeTelemetryKeyFindRequest(
FindCommandRequest fcr,
const boost::intrusive_ptr<ExpressionContext>& expCtx,
bool applyHmac = false,
@@ -71,12 +71,12 @@ public:
opts.applyHmacToIdentifiers = true;
opts.identifierHmacPolicy = applyHmacForTest;
}
- return findShapifier.makeQueryStatsKey(opts, expCtx);
+ return findShapifier.makeTelemetryKey(opts, expCtx);
}
};
-TEST_F(QueryStatsStoreTest, BasicUsage) {
- QueryStatsStore telStore{5000000, 1000};
+TEST_F(TelemetryStoreTest, BasicUsage) {
+ TelemetryStore telStore{5000000, 1000};
auto getMetrics = [&](const BSONObj& key) {
auto lookupResult = telStore.lookup(hash(key));
@@ -84,11 +84,11 @@ TEST_F(QueryStatsStoreTest, BasicUsage) {
};
auto collectMetrics = [&](BSONObj& key) {
- std::shared_ptr<QueryStatsEntry> metrics;
+ std::shared_ptr<TelemetryEntry> metrics;
auto lookupResult = telStore.lookup(hash(key));
if (!lookupResult.isOK()) {
telStore.put(hash(key),
- std::make_shared<QueryStatsEntry>(nullptr, NamespaceString{}, key));
+ std::make_shared<TelemetryEntry>(nullptr, NamespaceString{}, key));
lookupResult = telStore.lookup(hash(key));
}
metrics = *lookupResult.getValue();
@@ -127,39 +127,39 @@ TEST_F(QueryStatsStoreTest, BasicUsage) {
int numKeys = 0;
telStore.forEach(
- [&](std::size_t key, const std::shared_ptr<QueryStatsEntry>& entry) { numKeys++; });
+ [&](std::size_t key, const std::shared_ptr<TelemetryEntry>& entry) { numKeys++; });
ASSERT_EQ(numKeys, 2);
}
-TEST_F(QueryStatsStoreTest, EvictEntries) {
- // This creates a queryStats store with 2 partitions, each with a size of 1200 bytes.
+TEST_F(TelemetryStoreTest, EvictEntries) {
+ // This creates a telemetry store with 2 partitions, each with a size of 1200 bytes.
const auto cacheSize = 2400;
const auto numPartitions = 2;
- QueryStatsStore telStore{cacheSize, numPartitions};
+ TelemetryStore telStore{cacheSize, numPartitions};
for (int i = 0; i < 20; i++) {
auto query = BSON("query" + std::to_string(i) << 1 << "xEquals" << 42);
telStore.put(hash(query),
- std::make_shared<QueryStatsEntry>(nullptr, NamespaceString{}, BSONObj{}));
+ std::make_shared<TelemetryEntry>(nullptr, NamespaceString{}, BSONObj{}));
}
int numKeys = 0;
telStore.forEach(
- [&](std::size_t key, const std::shared_ptr<QueryStatsEntry>& entry) { numKeys++; });
+ [&](std::size_t key, const std::shared_ptr<TelemetryEntry>& entry) { numKeys++; });
int entriesPerPartition = (cacheSize / numPartitions) /
- (sizeof(std::size_t) + sizeof(QueryStatsEntry) + BSONObj().objsize());
+ (sizeof(std::size_t) + sizeof(TelemetryEntry) + BSONObj().objsize());
ASSERT_EQ(numKeys, entriesPerPartition * numPartitions);
}
-TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
+TEST_F(TelemetryStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
auto expCtx = make_intrusive<ExpressionContextForTest>();
FindCommandRequest fcr(NamespaceStringOrUUID(NamespaceString("testDB.testColl")));
fcr.setFilter(BSON("a" << 1));
- auto key = makeQueryStatsKeyFindRequest(
+ auto key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
@@ -181,7 +181,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
// Add sort.
fcr.setSort(BSON("sortVal" << 1 << "otherSort" << -1));
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -206,7 +206,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
// Add inclusion projection.
fcr.setProjection(BSON("e" << true << "f" << true));
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -239,7 +239,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
<< "$a"
<< "var2"
<< "const1"));
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -275,7 +275,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
fcr.setHint(BSON("z" << 1 << "c" << 1));
fcr.setMax(BSON("z" << 25));
fcr.setMin(BSON("z" << 80));
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -324,7 +324,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
fcr.setMaxTimeMS(1000);
fcr.setNoCursorTimeout(false);
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
@@ -380,7 +380,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
fcr.setShowRecordId(true);
fcr.setAwaitData(false);
fcr.setMirrored(true);
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
@@ -434,7 +434,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
key);
fcr.setAllowPartialResults(false);
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
// Make sure that a false allowPartialResults is also accurately captured.
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
@@ -488,7 +488,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestAllFields) {
key);
}
-TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestEmptyFields) {
+TEST_F(TelemetryStoreTest, CorrectlyRedactsFindCommandRequestEmptyFields) {
auto expCtx = make_intrusive<ExpressionContextForTest>();
FindCommandRequest fcr(NamespaceStringOrUUID(NamespaceString("testDB.testColl")));
FindRequestShapifier findShapifier(fcr, expCtx->opCtx);
@@ -500,7 +500,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestEmptyFields) {
opts.applyHmacToIdentifiers = true;
opts.identifierHmacPolicy = applyHmacForTest;
- auto hmacApplied = findShapifier.makeQueryStatsKey(opts, expCtx);
+ auto hmacApplied = findShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -515,7 +515,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsFindCommandRequestEmptyFields) {
hmacApplied); // NOLINT (test auto-update)
}
-TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
+TEST_F(TelemetryStoreTest, CorrectlyRedactsHintsWithOptions) {
auto expCtx = make_intrusive<ExpressionContextForTest>();
FindCommandRequest fcr(NamespaceStringOrUUID(NamespaceString("testDB.testColl")));
FindRequestShapifier findShapifier(fcr, expCtx->opCtx);
@@ -525,7 +525,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
fcr.setMax(BSON("z" << 25));
fcr.setMin(BSON("z" << 80));
- auto key = makeQueryStatsKeyFindRequest(
+ auto key = makeTelemetryKeyFindRequest(
fcr, expCtx, false, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
@@ -559,7 +559,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
fcr.setHint(BSON("$hint"
<< "z"));
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, false, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -588,7 +588,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
key);
fcr.setHint(BSON("z" << 1 << "c" << 1));
- key = makeQueryStatsKeyFindRequest(fcr, expCtx, true, LiteralSerializationPolicy::kUnchanged);
+ key = makeTelemetryKeyFindRequest(fcr, expCtx, true, LiteralSerializationPolicy::kUnchanged);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -616,7 +616,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
})",
key);
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -647,7 +647,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
// Test that $natural comes through unmodified.
fcr.setHint(BSON("$natural" << -1));
- key = makeQueryStatsKeyFindRequest(
+ key = makeTelemetryKeyFindRequest(
fcr, expCtx, true, LiteralSerializationPolicy::kToDebugTypeString);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
@@ -676,12 +676,12 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsHintsWithOptions) {
key);
}
-TEST_F(QueryStatsStoreTest, DefinesLetVariables) {
+TEST_F(TelemetryStoreTest, DefinesLetVariables) {
// Test that the expression context we use to apply hmac will understand the 'let' part of the
// find command while parsing the other pieces of the command.
// Note that this ExpressionContext will not have the let variables defined - we expect the
- // 'makeQueryStatsKey' call to do that.
+ // 'makeTelemetryKey' call to do that.
auto opCtx = makeOperationContext();
FindCommandRequest fcr(NamespaceStringOrUUID(NamespaceString("testDB.testColl")));
fcr.setLet(BSON("var" << 2));
@@ -690,14 +690,13 @@ TEST_F(QueryStatsStoreTest, DefinesLetVariables) {
const auto cmdObj = fcr.toBSON(BSON("$db"
<< "testDB"));
- QueryStatsEntry testMetrics{
- std::make_unique<query_stats::FindRequestShapifier>(fcr, opCtx.get()),
- fcr.getNamespaceOrUUID(),
- cmdObj};
+ TelemetryEntry testMetrics{std::make_unique<telemetry::FindRequestShapifier>(fcr, opCtx.get()),
+ fcr.getNamespaceOrUUID(),
+ cmdObj};
bool applyHmacToIdentifiers = false;
auto hmacApplied =
- testMetrics.computeQueryStatsKey(opCtx.get(), applyHmacToIdentifiers, std::string{});
+ testMetrics.computeTelemetryKey(opCtx.get(), applyHmacToIdentifiers, std::string{});
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -731,7 +730,7 @@ TEST_F(QueryStatsStoreTest, DefinesLetVariables) {
// do the hashing, so we'll just stick with the big long strings here for now.
applyHmacToIdentifiers = true;
hmacApplied =
- testMetrics.computeQueryStatsKey(opCtx.get(), applyHmacToIdentifiers, std::string{});
+ testMetrics.computeTelemetryKey(opCtx.get(), applyHmacToIdentifiers, std::string{});
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -762,7 +761,7 @@ TEST_F(QueryStatsStoreTest, DefinesLetVariables) {
hmacApplied);
}
-TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimplePipeline) {
+TEST_F(TelemetryStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimplePipeline) {
auto expCtx = make_intrusive<ExpressionContextForTest>();
AggregateCommandRequest acr(NamespaceString("testDB.testColl"));
auto matchStage = fromjson(R"({
@@ -791,7 +790,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimp
opts.applyHmacToIdentifiers = false;
opts.identifierHmacPolicy = applyHmacForTest;
- auto shapified = aggShapifier.makeQueryStatsKey(opts, expCtx);
+ auto shapified = aggShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -850,7 +849,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimp
opts.replacementForLiteralArgs = "?";
opts.literalPolicy = LiteralSerializationPolicy::kToDebugTypeString;
opts.applyHmacToIdentifiers = true;
- shapified = aggShapifier.makeQueryStatsKey(opts, expCtx);
+ shapified = aggShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -912,7 +911,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimp
acr.setHint(BSON("z" << 1 << "c" << 1));
acr.setCollation(BSON("locale"
<< "simple"));
- shapified = aggShapifier.makeQueryStatsKey(opts, expCtx);
+ shapified = aggShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -982,7 +981,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimp
<< "$foo"
<< "var2"
<< "bar"));
- shapified = aggShapifier.makeQueryStatsKey(opts, expCtx);
+ shapified = aggShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -1059,7 +1058,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimp
acr.setBypassDocumentValidation(true);
expCtx->opCtx->setComment(BSON("comment"
<< "note to self"));
- shapified = aggShapifier.makeQueryStatsKey(opts, expCtx);
+ shapified = aggShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -1133,7 +1132,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestAllFieldsSimp
})",
shapified);
}
-TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestEmptyFields) {
+TEST_F(TelemetryStoreTest, CorrectlyRedactsAggregateCommandRequestEmptyFields) {
auto expCtx = make_intrusive<ExpressionContextForTest>();
AggregateCommandRequest acr(NamespaceString("testDB.testColl"));
acr.setPipeline({});
@@ -1147,7 +1146,7 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestEmptyFields)
opts.applyHmacToIdentifiers = true;
opts.identifierHmacPolicy = applyHmacForTest;
- auto shapified = aggShapifier.makeQueryStatsKey(opts, expCtx);
+ auto shapified = aggShapifier.makeTelemetryKey(opts, expCtx);
ASSERT_BSONOBJ_EQ_AUTO( // NOLINT
R"({
"queryShape": {
@@ -1161,4 +1160,4 @@ TEST_F(QueryStatsStoreTest, CorrectlyRedactsAggregateCommandRequestEmptyFields)
})",
shapified); // NOLINT (test auto-update)
}
-} // namespace mongo::query_stats
+} // namespace mongo::telemetry
diff --git a/src/mongo/db/query/query_stats_util.cpp b/src/mongo/db/query/telemetry_util.cpp
index 4c102d983dc..eeaf7da71e6 100644
--- a/src/mongo/db/query/query_stats_util.cpp
+++ b/src/mongo/db/query/telemetry_util.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#include "mongo/db/query/query_stats_util.h"
+#include "mongo/db/query/telemetry_util.h"
#include "mongo/base/status.h"
#include "mongo/db/concurrency/d_concurrency.h"
@@ -40,25 +40,25 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kQuery
-namespace mongo::query_stats_util {
+namespace mongo::telemetry_util {
namespace {
/**
* Given the current 'Client', returns a pointer to the 'ServiceContext' and an interface for
- * updating the queryStats store.
+ * updating the telemetry store.
*/
std::pair<ServiceContext*, OnParamChangeUpdater*> getUpdater(const Client& client) {
auto serviceCtx = client.getServiceContext();
tassert(7106500, "ServiceContext must be non null", serviceCtx);
- auto updater = queryStatsStoreOnParamChangeUpdater(serviceCtx).get();
+ auto updater = telemetryStoreOnParamChangeUpdater(serviceCtx).get();
tassert(7106501, "Telemetry store size updater must be non null", updater);
return {serviceCtx, updater};
}
} // namespace
-Status onQueryStatsStoreSizeUpdate(const std::string& str) {
+Status onTelemetryStoreSizeUpdate(const std::string& str) {
auto newSize = memory_util::MemorySize::parse(str);
if (!newSize.isOK()) {
return newSize.getStatus();
@@ -75,11 +75,11 @@ Status onQueryStatsStoreSizeUpdate(const std::string& str) {
return Status::OK();
}
-Status validateQueryStatsStoreSize(const std::string& str, const boost::optional<TenantId>&) {
+Status validateTelemetryStoreSize(const std::string& str, const boost::optional<TenantId>&) {
return memory_util::MemorySize::parse(str).getStatus();
}
-Status onQueryStatsSamplingRateUpdate(int samplingRate) {
+Status onTelemetrySamplingRateUpdate(int samplingRate) {
// The client is nullptr if the parameter is supplied from the command line. In this case, we
// ignore the update event, the parameter will be processed when initializing the service
// context.
@@ -92,6 +92,6 @@ Status onQueryStatsSamplingRateUpdate(int samplingRate) {
}
const Decorable<ServiceContext>::Decoration<std::unique_ptr<OnParamChangeUpdater>>
- queryStatsStoreOnParamChangeUpdater =
+ telemetryStoreOnParamChangeUpdater =
ServiceContext::declareDecoration<std::unique_ptr<OnParamChangeUpdater>>();
-} // namespace mongo::query_stats_util
+} // namespace mongo::telemetry_util
diff --git a/src/mongo/db/query/query_stats_util.h b/src/mongo/db/query/telemetry_util.h
index ebd8f1e2fbd..c8fc37dc5c4 100644
--- a/src/mongo/db/query/query_stats_util.h
+++ b/src/mongo/db/query/telemetry_util.h
@@ -35,52 +35,52 @@
#include "mongo/db/query/util/memory_util.h"
-namespace mongo::query_stats_util {
+namespace mongo::telemetry_util {
-Status onQueryStatsStoreSizeUpdate(const std::string& str);
+Status onTelemetryStoreSizeUpdate(const std::string& str);
-Status validateQueryStatsStoreSize(const std::string& str, const boost::optional<TenantId>&);
+Status validateTelemetryStoreSize(const std::string& str, const boost::optional<TenantId>&);
-Status onQueryStatsSamplingRateUpdate(int samplingRate);
+Status onTelemetrySamplingRateUpdate(int samplingRate);
/**
- * An interface used to modify the queryStats store when query setParameters are modified. This is
+ * An interface used to modify the telemetry store when query setParameters are modified. This is
* done via an interface decorating the 'ServiceContext' in order to avoid a link-time dependency
- * of the query knobs library on the queryStats code.
+ * of the query knobs library on the telemetry code.
*/
class OnParamChangeUpdater {
public:
virtual ~OnParamChangeUpdater() = default;
/**
- * Resizes the queryStats store decorating 'serviceCtx' to the new size given by 'memSize'. If
+ * Resizes the telemetry store decorating 'serviceCtx' to the new size given by 'memSize'. If
* the new size is smaller than the old, cache entries are evicted in order to ensure the
* cache fits within the new size bound.
*/
virtual void updateCacheSize(ServiceContext* serviceCtx, memory_util::MemorySize memSize) = 0;
/**
- * Updates the sampling rate for the queryStats rate limiter.
+ * Updates the sampling rate for the telemetry rate limiter.
*/
virtual void updateSamplingRate(ServiceContext* serviceCtx, int samplingRate) = 0;
};
/**
- * A stub implementation that does not allow changing any parameters - to be used if the queryStats
+ * A stub implementation that does not allow changing any parameters - to be used if the telemetry
* store is disabled and cannot be re-enabled without restarting, as with a feature flag.
*/
class NoChangesAllowedTelemetryParamUpdater : public OnParamChangeUpdater {
public:
void updateCacheSize(ServiceContext* serviceCtx, memory_util::MemorySize memSize) final {
uasserted(7373500,
- "Cannot configure queryStats store - it is currently disabled and a restart is "
+ "Cannot configure telemetry store - it is currently disabled and a restart is "
"required to activate.");
}
void updateSamplingRate(ServiceContext* serviceCtx, int samplingRate) {
uasserted(7506200,
- "Cannot configure queryStats store - it is currently disabled and a restart is "
+ "Cannot configure telemetry store - it is currently disabled and a restart is "
"required to activate.");
}
};
@@ -89,5 +89,5 @@ public:
* Decorated accessor to the 'OnParamChangeUpdater' stored in 'ServiceContext'.
*/
extern const Decorable<ServiceContext>::Decoration<std::unique_ptr<OnParamChangeUpdater>>
- queryStatsStoreOnParamChangeUpdater;
-} // namespace mongo::query_stats_util
+ telemetryStoreOnParamChangeUpdater;
+} // namespace mongo::telemetry_util