diff options
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/commands/cluster_find_cmd.h | 12 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_aggregate.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_aggregation_planner.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor.h | 4 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor_impl.cpp | 27 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor_impl.h | 10 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor_mock.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor_mock.h | 2 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_cursor_manager.cpp | 18 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_cursor_manager.h | 10 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_find.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/query/store_possible_cursor.cpp | 4 |
12 files changed, 55 insertions, 54 deletions
diff --git a/src/mongo/s/commands/cluster_find_cmd.h b/src/mongo/s/commands/cluster_find_cmd.h index 942e0893434..6ab7d513d86 100644 --- a/src/mongo/s/commands/cluster_find_cmd.h +++ b/src/mongo/s/commands/cluster_find_cmd.h @@ -39,7 +39,7 @@ #include "mongo/db/matcher/extensions_callback_noop.h" #include "mongo/db/query/cursor_response.h" #include "mongo/db/query/find_request_shapifier.h" -#include "mongo/db/query/telemetry.h" +#include "mongo/db/query/query_stats.h" #include "mongo/db/stats/counters.h" #include "mongo/db/views/resolved_view.h" #include "mongo/rpc/get_status_from_command_result.h" @@ -225,11 +225,11 @@ public: MatchExpressionParser::kAllowAllSpecialFeatures)); if (!_didDoFLERewrite) { - telemetry::registerRequest(std::make_unique<telemetry::FindRequestShapifier>( - cq->getFindCommandRequest(), opCtx), - cq->nss(), - opCtx, - cq->getExpCtx()); + query_stats::registerRequest(std::make_unique<query_stats::FindRequestShapifier>( + cq->getFindCommandRequest(), opCtx), + cq->nss(), + opCtx, + cq->getExpCtx()); } try { diff --git a/src/mongo/s/query/cluster_aggregate.cpp b/src/mongo/s/query/cluster_aggregate.cpp index 6c9351efe57..9fd49e2e004 100644 --- a/src/mongo/s/query/cluster_aggregate.cpp +++ b/src/mongo/s/query/cluster_aggregate.cpp @@ -56,7 +56,7 @@ #include "mongo/db/query/explain_common.h" #include "mongo/db/query/find_common.h" #include "mongo/db/query/fle/server_rewrite.h" -#include "mongo/db/query/telemetry.h" +#include "mongo/db/query/query_stats.h" #include "mongo/db/timeseries/timeseries_gen.h" #include "mongo/db/timeseries/timeseries_options.h" #include "mongo/db/views/resolved_view.h" @@ -324,7 +324,7 @@ Status ClusterAggregate::runAggregate(OperationContext* opCtx, auto startsWithDocuments = liteParsedPipeline.startsWithDocuments(); if (!shouldDoFLERewrite) { - telemetry::registerAggRequest(request, opCtx); + query_stats::registerAggRequest(request, opCtx); } // If the routing table is not already taken by the higher level, fill it now. diff --git a/src/mongo/s/query/cluster_aggregation_planner.cpp b/src/mongo/s/query/cluster_aggregation_planner.cpp index 5aa643c0a85..8f2c6fcdb19 100644 --- a/src/mongo/s/query/cluster_aggregation_planner.cpp +++ b/src/mongo/s/query/cluster_aggregation_planner.cpp @@ -360,16 +360,16 @@ BSONObj establishMergingMongosCursor(OperationContext* opCtx, int nShards = ccc->getNumRemotes(); auto&& opDebug = CurOp::get(opCtx)->debug(); - // Fill out the aggregation metrics in CurOp, and record telemetry metrics, before detaching the - // cursor from its opCtx. + // Fill out the aggregation metrics in CurOp, and record queryStats metrics, before detaching + // the cursor from its opCtx. opDebug.nShards = std::max(opDebug.nShards, nShards); opDebug.cursorExhausted = exhausted; opDebug.additiveMetrics.nBatches = 1; CurOp::get(opCtx)->setEndOfOpMetrics(responseBuilder.numDocs()); if (exhausted) { - collectTelemetryMongos(opCtx, ccc->getRequestShapifier()); + collectQueryStatsMongos(opCtx, ccc->getRequestShapifier()); } else { - collectTelemetryMongos(opCtx, ccc); + collectQueryStatsMongos(opCtx, ccc); } ccc->detachFromOperationContext(); diff --git a/src/mongo/s/query/cluster_client_cursor.h b/src/mongo/s/query/cluster_client_cursor.h index 1f0d9be54a7..008bacd5ef6 100644 --- a/src/mongo/s/query/cluster_client_cursor.h +++ b/src/mongo/s/query/cluster_client_cursor.h @@ -270,11 +270,11 @@ public: * Returns and releases ownership of the RequestShapifier associated with the request this * cursor is handling. */ - virtual std::unique_ptr<telemetry::RequestShapifier> getRequestShapifier() = 0; + virtual std::unique_ptr<query_stats::RequestShapifier> getRequestShapifier() = 0; protected: // Metrics that are accumulated over the lifetime of the cursor, incremented with each getMore. - // Useful for diagnostics like telemetry. + // Useful for diagnostics like queryStats. OpDebug::AdditiveMetrics _metrics; private: diff --git a/src/mongo/s/query/cluster_client_cursor_impl.cpp b/src/mongo/s/query/cluster_client_cursor_impl.cpp index 939637d0f32..9da06d36881 100644 --- a/src/mongo/s/query/cluster_client_cursor_impl.cpp +++ b/src/mongo/s/query/cluster_client_cursor_impl.cpp @@ -32,7 +32,7 @@ #include <memory> #include "mongo/db/curop.h" -#include "mongo/db/query/telemetry.h" +#include "mongo/db/query/query_stats.h" #include "mongo/logv2/log.h" #include "mongo/s/query/router_stage_limit.h" #include "mongo/s/query/router_stage_merge.h" @@ -75,9 +75,10 @@ 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)) { + _queryStatsStoreKeyHash(CurOp::get(opCtx)->debug().queryStatsStoreKeyHash), + _queryStatsStoreKey(CurOp::get(opCtx)->debug().queryStatsStoreKey), + _queryStatsRequestShapifier( + std::move(CurOp::get(opCtx)->debug().queryStatsRequestShapifier)) { dassert(!_params.compareWholeSortKeyOnRouter || SimpleBSONObjComparator::kInstance.evaluate( _params.sortToApplyOnRouter == AsyncResultsMerger::kWholeSortKeySortPattern)); @@ -137,13 +138,13 @@ void ClusterClientCursorImpl::kill(OperationContext* opCtx) { "Cannot kill a cluster client cursor that has already been killed", !_hasBeenKilled); - if (_telemetryStoreKeyHash && opCtx) { - telemetry::writeTelemetry(opCtx, - _telemetryStoreKeyHash, - _telemetryStoreKey, - std::move(_telemetryRequestShapifier), - _metrics.executionTime.value_or(Microseconds{0}).count(), - _metrics.nreturned.value_or(0)); + if (_queryStatsStoreKeyHash && opCtx) { + query_stats::writeQueryStats(opCtx, + _queryStatsStoreKeyHash, + _queryStatsStoreKey, + std::move(_queryStatsRequestShapifier), + _metrics.executionTime.value_or(Microseconds{0}).count(), + _metrics.nreturned.value_or(0)); } _root->kill(opCtx); @@ -285,8 +286,8 @@ bool ClusterClientCursorImpl::shouldOmitDiagnosticInformation() const { return _shouldOmitDiagnosticInformation; } -std::unique_ptr<telemetry::RequestShapifier> ClusterClientCursorImpl::getRequestShapifier() { - return std::move(_telemetryRequestShapifier); +std::unique_ptr<query_stats::RequestShapifier> ClusterClientCursorImpl::getRequestShapifier() { + return std::move(_queryStatsRequestShapifier); } } // namespace mongo diff --git a/src/mongo/s/query/cluster_client_cursor_impl.h b/src/mongo/s/query/cluster_client_cursor_impl.h index ecb7535715c..9d9168d6afb 100644 --- a/src/mongo/s/query/cluster_client_cursor_impl.h +++ b/src/mongo/s/query/cluster_client_cursor_impl.h @@ -121,7 +121,7 @@ public: bool shouldOmitDiagnosticInformation() const final; - std::unique_ptr<telemetry::RequestShapifier> getRequestShapifier() final; + std::unique_ptr<query_stats::RequestShapifier> getRequestShapifier() final; public: /** @@ -186,12 +186,12 @@ 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; + boost::optional<std::size_t> _queryStatsStoreKeyHash; + // TODO: SERVER-73152 remove queryStatsStoreKey when RequestShapifier is used for agg. + boost::optional<BSONObj> _queryStatsStoreKey; // The RequestShapifier used by telemetry to shapify the request payload into the telemetry // store key. - std::unique_ptr<telemetry::RequestShapifier> _telemetryRequestShapifier; + std::unique_ptr<query_stats::RequestShapifier> _queryStatsRequestShapifier; // Tracks if kill() has been called on the cursor. Multiple calls to kill() is an error. bool _hasBeenKilled = false; diff --git a/src/mongo/s/query/cluster_client_cursor_mock.cpp b/src/mongo/s/query/cluster_client_cursor_mock.cpp index e495227b704..1e8b3561f5c 100644 --- a/src/mongo/s/query/cluster_client_cursor_mock.cpp +++ b/src/mongo/s/query/cluster_client_cursor_mock.cpp @@ -170,7 +170,7 @@ bool ClusterClientCursorMock::shouldOmitDiagnosticInformation() const { return false; } -std::unique_ptr<telemetry::RequestShapifier> ClusterClientCursorMock::getRequestShapifier() { +std::unique_ptr<query_stats::RequestShapifier> ClusterClientCursorMock::getRequestShapifier() { return nullptr; } diff --git a/src/mongo/s/query/cluster_client_cursor_mock.h b/src/mongo/s/query/cluster_client_cursor_mock.h index 131ca234287..750a67abdde 100644 --- a/src/mongo/s/query/cluster_client_cursor_mock.h +++ b/src/mongo/s/query/cluster_client_cursor_mock.h @@ -121,7 +121,7 @@ public: bool shouldOmitDiagnosticInformation() const final; - std::unique_ptr<telemetry::RequestShapifier> getRequestShapifier() final; + std::unique_ptr<query_stats::RequestShapifier> getRequestShapifier() final; private: bool _killed = false; diff --git a/src/mongo/s/query/cluster_cursor_manager.cpp b/src/mongo/s/query/cluster_cursor_manager.cpp index d8e47e55ecf..68436d25c6e 100644 --- a/src/mongo/s/query/cluster_cursor_manager.cpp +++ b/src/mongo/s/query/cluster_cursor_manager.cpp @@ -38,7 +38,7 @@ #include "mongo/db/allocate_cursor_id.h" #include "mongo/db/curop.h" #include "mongo/db/query/query_knobs_gen.h" -#include "mongo/db/query/telemetry.h" +#include "mongo/db/query/query_stats.h" #include "mongo/db/session/kill_sessions_common.h" #include "mongo/db/session/logical_session_cache.h" #include "mongo/logv2/log.h" @@ -591,25 +591,25 @@ StatusWith<ClusterClientCursorGuard> ClusterCursorManager::_detachCursor(WithLoc return std::move(cursor); } -void collectTelemetryMongos(OperationContext* opCtx, - std::unique_ptr<telemetry::RequestShapifier> requestShapifier) { +void collectQueryStatsMongos(OperationContext* opCtx, + std::unique_ptr<query_stats::RequestShapifier> requestShapifier) { // If we haven't registered a cursor to prepare for getMore requests, we record - // telemetry directly. + // queryStats directly. auto&& opDebug = CurOp::get(opCtx)->debug(); - telemetry::writeTelemetry( + query_stats::writeQueryStats( opCtx, - opDebug.telemetryStoreKeyHash, - opDebug.telemetryStoreKey, + opDebug.queryStatsStoreKeyHash, + opDebug.queryStatsStoreKey, std::move(requestShapifier), opDebug.additiveMetrics.executionTime.value_or(Microseconds{0}).count(), opDebug.additiveMetrics.nreturned.value_or(0)); } -void collectTelemetryMongos(OperationContext* opCtx, ClusterClientCursorGuard& cursor) { +void collectQueryStatsMongos(OperationContext* opCtx, ClusterClientCursorGuard& cursor) { cursor->incrementCursorMetrics(CurOp::get(opCtx)->debug().additiveMetrics); } -void collectTelemetryMongos(OperationContext* opCtx, ClusterCursorManager::PinnedCursor& cursor) { +void collectQueryStatsMongos(OperationContext* opCtx, ClusterCursorManager::PinnedCursor& cursor) { cursor->incrementCursorMetrics(CurOp::get(opCtx)->debug().additiveMetrics); } diff --git a/src/mongo/s/query/cluster_cursor_manager.h b/src/mongo/s/query/cluster_cursor_manager.h index 219dd773f82..b10824baf09 100644 --- a/src/mongo/s/query/cluster_cursor_manager.h +++ b/src/mongo/s/query/cluster_cursor_manager.h @@ -600,7 +600,7 @@ private: }; /** - * Record metrics for the current operation on opDebug and aggregates those metrics for telemetry + * Record metrics for the current operation on opDebug and aggregates those metrics for queryStats * use. If a cursor is provided (via ClusterClientCursorGuard or * ClusterCursorManager::PinnedCursor), metrics are aggregated on the cursor; otherwise, metrics are * written directly to the telemetry store. @@ -610,9 +610,9 @@ private: * Currently, telemetry is only collected for find and aggregate requests (and their subsequent * getMore requests), so these should only be called from those request paths. */ -void collectTelemetryMongos(OperationContext* opCtx, - std::unique_ptr<telemetry::RequestShapifier> requestShapifier); -void collectTelemetryMongos(OperationContext* opCtx, ClusterClientCursorGuard& cursor); -void collectTelemetryMongos(OperationContext* opCtx, ClusterCursorManager::PinnedCursor& cursor); +void collectQueryStatsMongos(OperationContext* opCtx, + std::unique_ptr<query_stats::RequestShapifier> requestShapifier); +void collectQueryStatsMongos(OperationContext* opCtx, ClusterClientCursorGuard& cursor); +void collectQueryStatsMongos(OperationContext* opCtx, ClusterCursorManager::PinnedCursor& cursor); } // namespace mongo diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp index 5b340ec098a..d0bd48a0d51 100644 --- a/src/mongo/s/query/cluster_find.cpp +++ b/src/mongo/s/query/cluster_find.cpp @@ -48,7 +48,7 @@ #include "mongo/db/query/find_common.h" #include "mongo/db/query/getmore_command_gen.h" #include "mongo/db/query/query_planner_common.h" -#include "mongo/db/query/telemetry.h" +#include "mongo/db/query/query_stats.h" #include "mongo/executor/task_executor_pool.h" #include "mongo/logv2/log.h" #include "mongo/platform/overflow_arithmetic.h" @@ -444,7 +444,7 @@ CursorId runQueryWithoutRetrying(OperationContext* opCtx, if (shardIds.size() > 0) { updateNumHostsTargetedMetrics(opCtx, cm, shardIds.size()); } - collectTelemetryMongos(opCtx, ccc->getRequestShapifier()); + collectQueryStatsMongos(opCtx, ccc->getRequestShapifier()); return CursorId(0); } @@ -455,7 +455,7 @@ CursorId runQueryWithoutRetrying(OperationContext* opCtx, ? ClusterCursorManager::CursorLifetime::Immortal : ClusterCursorManager::CursorLifetime::Mortal; auto authUser = AuthorizationSession::get(opCtx->getClient())->getAuthenticatedUserName(); - collectTelemetryMongos(opCtx, ccc); + collectQueryStatsMongos(opCtx, ccc); auto cursorId = uassertStatusOK(cursorManager->registerCursor( opCtx, ccc.releaseCursor(), query.nss(), cursorType, cursorLifetime, authUser)); @@ -923,7 +923,7 @@ StatusWith<CursorResponse> ClusterFind::runGetMore(OperationContext* opCtx, const bool partialResultsReturned = pinnedCursor.getValue()->partialResultsReturned(); pinnedCursor.getValue()->setLeftoverMaxTimeMicros(opCtx->getRemainingMaxTimeMicros()); - collectTelemetryMongos(opCtx, pinnedCursor.getValue()); + collectQueryStatsMongos(opCtx, pinnedCursor.getValue()); // Upon successful completion, transfer ownership of the cursor back to the cursor manager. If // the cursor has been exhausted, the cursor manager will clean it up for us. diff --git a/src/mongo/s/query/store_possible_cursor.cpp b/src/mongo/s/query/store_possible_cursor.cpp index 38cec4024ed..a5c6759f4d1 100644 --- a/src/mongo/s/query/store_possible_cursor.cpp +++ b/src/mongo/s/query/store_possible_cursor.cpp @@ -98,7 +98,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx, if (incomingCursorResponse.getValue().getCursorId() == CursorId(0)) { opDebug.cursorExhausted = true; - collectTelemetryMongos(opCtx, std::move(opDebug.telemetryRequestShapifier)); + collectQueryStatsMongos(opCtx, std::move(opDebug.queryStatsRequestShapifier)); return cmdResult; } @@ -130,7 +130,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx, } auto ccc = ClusterClientCursorImpl::make(opCtx, std::move(executor), std::move(params)); - collectTelemetryMongos(opCtx, ccc); + collectQueryStatsMongos(opCtx, ccc); // We don't expect to use this cursor until a subsequent getMore, so detach from the current // OperationContext until then. ccc->detachFromOperationContext(); |