summaryrefslogtreecommitdiff
path: root/src/mongo/s/query/cluster_client_cursor.h
diff options
context:
space:
mode:
authorWill Buerger <will.buerger@mongodb.com>2023-03-01 17:27:23 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-03-01 21:26:19 +0000
commit12f2e3d221ac01156db60f307d433b56340115c3 (patch)
tree78cefa99ff44c7215c04d0a41777dcc7e90486a5 /src/mongo/s/query/cluster_client_cursor.h
parentc80ca4373ac767037563691c9dd69f57258f2756 (diff)
downloadmongo-12f2e3d221ac01156db60f307d433b56340115c3.tar.gz
SERVER-73727: Aggregate mongos metrics in ClusterClientCursor
Diffstat (limited to 'src/mongo/s/query/cluster_client_cursor.h')
-rw-r--r--src/mongo/s/query/cluster_client_cursor.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/s/query/cluster_client_cursor.h b/src/mongo/s/query/cluster_client_cursor.h
index 57c2fa7d100..a83b50f9287 100644
--- a/src/mongo/s/query/cluster_client_cursor.h
+++ b/src/mongo/s/query/cluster_client_cursor.h
@@ -221,6 +221,14 @@ public:
*/
virtual void incNBatches() = 0;
+ void incrementCursorMetrics(OpDebug::AdditiveMetrics newMetrics,
+ uint64_t newExecutionTime,
+ uint64_t newDocsReturned) {
+ _metrics.add(newMetrics);
+ _queryExecMicros += newExecutionTime;
+ _docsReturned += newDocsReturned;
+ }
+
//
// maxTimeMS support.
//
@@ -245,6 +253,12 @@ public:
_leftoverMaxTimeMicros = leftoverMaxTimeMicros;
}
+protected:
+ // Metrics used for telemetry. TODO SERVER-73933 consider merging more into '_metrics'
+ uint64_t _queryExecMicros = 0;
+ uint64_t _docsReturned = 0;
+ OpDebug::AdditiveMetrics _metrics;
+
private:
// Unused maxTime budget for this cursor.
Microseconds _leftoverMaxTimeMicros = Microseconds::max();