summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/run_aggregate.cpp
diff options
context:
space:
mode:
authorDavis Haupt <davis.haupt@mongodb.com>2022-11-14 22:19:12 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-14 22:56:15 +0000
commit682d0882c0c8b570f5c8cf247af2b806bd1a7299 (patch)
tree602d5f20a32f92b47d17bc331ff45a879fa5b1b3 /src/mongo/db/commands/run_aggregate.cpp
parente9938eb5d24314c0f8b65b5678ee082ce416c12e (diff)
downloadmongo-682d0882c0c8b570f5c8cf247af2b806bd1a7299.tar.gz
SERVER-71244 Do not collect telemetry for FLE2 requests
Diffstat (limited to 'src/mongo/db/commands/run_aggregate.cpp')
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 159fd47923a..493c9a9544c 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -727,6 +727,10 @@ Status runAggregate(OperationContext* opCtx,
auto catalog = CollectionCatalog::get(opCtx);
boost::optional<BSONObj> telemetryKey;
+ // Since we remove encryptionInformation after rewriting a FLE2 query, this boolean keeps track
+ // of whether the input query did originally have enryption information.
+ bool didDoFLERewrite = false;
+
{
// If we are in a transaction, check whether the parsed pipeline supports being in
// a transaction and if the transaction's read concern is supported.
@@ -953,6 +957,7 @@ Status runAggregate(OperationContext* opCtx,
pipeline = processFLEPipelineD(
opCtx, nss, request.getEncryptionInformation().value(), std::move(pipeline));
request.setEncryptionInformation(boost::none);
+ didDoFLERewrite = true;
}
pipeline->optimizePipeline();
@@ -1096,17 +1101,21 @@ Status runAggregate(OperationContext* opCtx,
curOp->debug().setPlanSummaryMetrics(stats);
curOp->debug().nreturned = stats.nReturned;
- telemetryKey = telemetry::shouldCollectTelemetry(request, opCtx);
- // Build the telemetry key and store it in the operation context
- if (telemetryKey) {
- // TODO SERVER-71315: should we store it in the CurOp instead? (or even PlanExplainer)
- opCtx->storeQueryBSON(*telemetryKey);
- }
-
+ // FLE2 queries should not be included in telemetry, so make sure that we did not
+ // rewrite this query before collecting telemetry.
+ if (!didDoFLERewrite) {
+ telemetryKey = telemetry::shouldCollectTelemetry(request, opCtx);
+ // Build the telemetry key and store it in the operation context
+ if (telemetryKey) {
+ // TODO SERVER-71315: should we store it in the CurOp instead? (or even
+ // PlanExplainer)
+ opCtx->storeQueryBSON(*telemetryKey);
+ }
- if (telemetryKey) {
- telemetry::collectTelemetry(
- opCtx->getServiceContext(), *telemetryKey, curOp->debug(), true);
+ if (telemetryKey) {
+ telemetry::collectTelemetry(
+ opCtx->getServiceContext(), *telemetryKey, curOp->debug(), true);
+ }
}
// For an optimized away pipeline, signal the cache that a query operation has completed.