summaryrefslogtreecommitdiff
path: root/src/mongo/s/query
diff options
context:
space:
mode:
authorDavis Haupt <davis.haupt@mongodb.com>2023-05-15 13:22:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-15 15:24:46 +0000
commit572a0c3987787a66f0192009b30651b8bae822ff (patch)
treea9613a37fccc420c88cd113f0ad419824ddf25df /src/mongo/s/query
parent8896b5ba5a84d1b6b63953b9009ca16eda69d3c6 (diff)
downloadmongo-572a0c3987787a66f0192009b30651b8bae822ff.tar.gz
SERVER-75512 key telemetry store on hash rather than BSONObj
Diffstat (limited to 'src/mongo/s/query')
-rw-r--r--src/mongo/s/query/cluster_client_cursor_impl.cpp4
-rw-r--r--src/mongo/s/query/cluster_client_cursor_impl.h3
-rw-r--r--src/mongo/s/query/cluster_cursor_manager.cpp1
3 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/s/query/cluster_client_cursor_impl.cpp b/src/mongo/s/query/cluster_client_cursor_impl.cpp
index 9cc44be6811..939637d0f32 100644
--- a/src/mongo/s/query/cluster_client_cursor_impl.cpp
+++ b/src/mongo/s/query/cluster_client_cursor_impl.cpp
@@ -75,6 +75,7 @@ ClusterClientCursorImpl::ClusterClientCursorImpl(OperationContext* opCtx,
_lastUseDate(_createdDate),
_queryHash(CurOp::get(opCtx)->debug().queryHash),
_shouldOmitDiagnosticInformation(CurOp::get(opCtx)->debug().shouldOmitDiagnosticInformation),
+ _telemetryStoreKeyHash(CurOp::get(opCtx)->debug().telemetryStoreKeyHash),
_telemetryStoreKey(CurOp::get(opCtx)->debug().telemetryStoreKey),
_telemetryRequestShapifier(std::move(CurOp::get(opCtx)->debug().telemetryRequestShapifier)) {
dassert(!_params.compareWholeSortKeyOnRouter ||
@@ -136,8 +137,9 @@ void ClusterClientCursorImpl::kill(OperationContext* opCtx) {
"Cannot kill a cluster client cursor that has already been killed",
!_hasBeenKilled);
- if (_telemetryStoreKey && opCtx) {
+ if (_telemetryStoreKeyHash && opCtx) {
telemetry::writeTelemetry(opCtx,
+ _telemetryStoreKeyHash,
_telemetryStoreKey,
std::move(_telemetryRequestShapifier),
_metrics.executionTime.value_or(Microseconds{0}).count(),
diff --git a/src/mongo/s/query/cluster_client_cursor_impl.h b/src/mongo/s/query/cluster_client_cursor_impl.h
index 8f23c25ff02..ecb7535715c 100644
--- a/src/mongo/s/query/cluster_client_cursor_impl.h
+++ b/src/mongo/s/query/cluster_client_cursor_impl.h
@@ -32,6 +32,7 @@
#include <memory>
#include <queue>
+#include "mongo/bson/bsonobj.h"
#include "mongo/executor/task_executor.h"
#include "mongo/s/query/cluster_client_cursor.h"
#include "mongo/s/query/cluster_client_cursor_guard.h"
@@ -185,6 +186,8 @@ private:
bool _shouldOmitDiagnosticInformation = false;
// If boost::none, telemetry should not be collected for this cursor.
+ boost::optional<std::size_t> _telemetryStoreKeyHash;
+ // TODO: SERVER-73152 remove telemetryStoreKey when RequestShapifier is used for agg.
boost::optional<BSONObj> _telemetryStoreKey;
// The RequestShapifier used by telemetry to shapify the request payload into the telemetry
// store key.
diff --git a/src/mongo/s/query/cluster_cursor_manager.cpp b/src/mongo/s/query/cluster_cursor_manager.cpp
index 1cfbd7bf700..d8e47e55ecf 100644
--- a/src/mongo/s/query/cluster_cursor_manager.cpp
+++ b/src/mongo/s/query/cluster_cursor_manager.cpp
@@ -598,6 +598,7 @@ void collectTelemetryMongos(OperationContext* opCtx,
auto&& opDebug = CurOp::get(opCtx)->debug();
telemetry::writeTelemetry(
opCtx,
+ opDebug.telemetryStoreKeyHash,
opDebug.telemetryStoreKey,
std::move(requestShapifier),
opDebug.additiveMetrics.executionTime.value_or(Microseconds{0}).count(),