summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/run_aggregate.cpp
diff options
context:
space:
mode:
authorjoshua <80741223+jlap199@users.noreply.github.com>2022-11-15 03:55:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-15 04:37:36 +0000
commit0fff039b24fa1fdf14d940c5de7dbfc90e59d5a6 (patch)
tree0dea056531605ccbd796a99554a3a6b2c11cfd21 /src/mongo/db/commands/run_aggregate.cpp
parent942719f40be8488c3644ebc4dbf4f18fb3220e93 (diff)
downloadmongo-0fff039b24fa1fdf14d940c5de7dbfc90e59d5a6.tar.gz
SERVER-71315 Decide where to store the Telemetry key
Diffstat (limited to 'src/mongo/db/commands/run_aggregate.cpp')
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 493c9a9544c..fc6c914e603 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -725,7 +725,8 @@ Status runAggregate(OperationContext* opCtx,
boost::intrusive_ptr<ExpressionContext> expCtx;
auto curOp = CurOp::get(opCtx);
auto catalog = CollectionCatalog::get(opCtx);
- boost::optional<BSONObj> telemetryKey;
+
+ telemetry::registerAggRequest(request, opCtx);
// Since we remove encryptionInformation after rewriting a FLE2 query, this boolean keeps track
// of whether the input query did originally have enryption information.
@@ -1101,22 +1102,7 @@ Status runAggregate(OperationContext* opCtx,
curOp->debug().setPlanSummaryMetrics(stats);
curOp->debug().nreturned = stats.nReturned;
- // 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);
- }
- }
+ telemetry::recordExecution(opCtx, curOp->debug(), didDoFLERewrite);
// For an optimized away pipeline, signal the cache that a query operation has completed.
// For normal pipelines this is done in DocumentSourceCursor.