summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_find_cmd.h
diff options
context:
space:
mode:
authorDavis Haupt <davis.haupt@mongodb.com>2023-02-07 14:28:27 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-07 15:11:49 +0000
commit5b1a7a5cbe024b7bb123abb91020eb9997120259 (patch)
tree5b1e0d91349e93707b28167a5b51b0e3768e8482 /src/mongo/s/commands/cluster_find_cmd.h
parent713c60157fea0cab9da39ff90a8d0a8eb6583a1b (diff)
downloadmongo-5b1a7a5cbe024b7bb123abb91020eb9997120259.tar.gz
SERVER-73407 Collect telemetry on mongos for find and aggr6.3.0-rc0
Diffstat (limited to 'src/mongo/s/commands/cluster_find_cmd.h')
-rw-r--r--src/mongo/s/commands/cluster_find_cmd.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/s/commands/cluster_find_cmd.h b/src/mongo/s/commands/cluster_find_cmd.h
index 360b2e6ce1b..52b1149e0fe 100644
--- a/src/mongo/s/commands/cluster_find_cmd.h
+++ b/src/mongo/s/commands/cluster_find_cmd.h
@@ -38,6 +38,7 @@
#include "mongo/db/fle_crud.h"
#include "mongo/db/matcher/extensions_callback_noop.h"
#include "mongo/db/query/cursor_response.h"
+#include "mongo/db/query/telemetry.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/views/resolved_view.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -224,6 +225,10 @@ public:
ExtensionsCallbackNoop(),
MatchExpressionParser::kAllowAllSpecialFeatures));
+ if (!_didDoFLERewrite) {
+ telemetry::registerFindRequest(cq->getFindCommandRequest(), cq->nss(), opCtx);
+ }
+
try {
// Do the work to generate the first batch of results. This blocks waiting to get
// responses from the shard(s).
@@ -245,6 +250,7 @@ public:
}
firstBatch.setPartialResultsReturned(partialResultsReturned);
firstBatch.done(cursorId, cq->nss());
+ telemetry::recordExecution(opCtx, _didDoFLERewrite);
} catch (const ExceptionFor<ErrorCodes::CommandOnShardedViewNotSupportedOnMongod>& ex) {
result->reset();
@@ -277,7 +283,7 @@ public:
* were supplied with the command, and sets the constant runtime values that will be
* forwarded to each shard.
*/
- static std::unique_ptr<FindCommandRequest> _parseCmdObjectToFindCommandRequest(
+ std::unique_ptr<FindCommandRequest> _parseCmdObjectToFindCommandRequest(
OperationContext* opCtx, NamespaceString nss, BSONObj cmdObj) {
auto findCommand = query_request_helper::makeFromFindCommand(
std::move(cmdObj),
@@ -301,6 +307,7 @@ public:
invariant(findCommand->getNamespaceOrUUID().nss());
processFLEFindS(
opCtx, findCommand->getNamespaceOrUUID().nss().get(), findCommand.get());
+ _didDoFLERewrite = true;
}
return findCommand;
@@ -308,6 +315,7 @@ public:
const OpMsgRequest& _request;
const DatabaseName _dbName;
+ bool _didDoFLERewrite{false};
};
};