summaryrefslogtreecommitdiff
path: root/src/mongo/db/stats
diff options
context:
space:
mode:
authorMariano Shaar <mariano.shaar@mongodb.com>2022-07-25 19:59:18 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-25 20:44:42 +0000
commit47b350b3e07abe90a03fc1ed29ece8cbae5e8287 (patch)
tree48adddeb5f6c49fa2b926fdccdf1bc4b91237a00 /src/mongo/db/stats
parent551702840ef15f40b6db4f58f001872363eb9d48 (diff)
downloadmongo-47b350b3e07abe90a03fc1ed29ece8cbae5e8287.tar.gz
SERVER-64539 Add serverStatus metrics for the SBE $lookup project
Diffstat (limited to 'src/mongo/db/stats')
-rw-r--r--src/mongo/db/stats/counters.cpp1
-rw-r--r--src/mongo/db/stats/counters.h26
2 files changed, 27 insertions, 0 deletions
diff --git a/src/mongo/db/stats/counters.cpp b/src/mongo/db/stats/counters.cpp
index eb436737a4a..e354f51f634 100644
--- a/src/mongo/db/stats/counters.cpp
+++ b/src/mongo/db/stats/counters.cpp
@@ -338,6 +338,7 @@ AuthCounter authCounter;
AggStageCounters aggStageCounters;
DotsAndDollarsFieldsCounters dotsAndDollarsFieldsCounters;
QueryEngineCounters queryEngineCounters;
+LookupPushdownCounters lookupPushdownCounters;
OperatorCounters operatorCountersAggExpressions{"operatorCounters.expressions."};
OperatorCounters operatorCountersMatchExpressions{"operatorCounters.match."};
diff --git a/src/mongo/db/stats/counters.h b/src/mongo/db/stats/counters.h
index 815a6856772..3c01c3eb626 100644
--- a/src/mongo/db/stats/counters.h
+++ b/src/mongo/db/stats/counters.h
@@ -376,6 +376,32 @@ public:
};
extern QueryEngineCounters queryEngineCounters;
+class LookupPushdownCounters {
+public:
+ LookupPushdownCounters() = default;
+
+ void incrementLookupCounters(OpDebug& debug) {
+ if (debug.pipelineUsesLookup) {
+ totalLookup.increment();
+ }
+ nestedLoopJoin.increment(debug.nestedLoopJoin);
+ indexedLoopJoin.increment(debug.indexedLoopJoin);
+ hashLookup.increment(debug.hashLookup);
+ hashLookupSpillToDisk.increment(debug.hashLookupSpillToDisk);
+ }
+
+ // Counter tracking pipelines that have a lookup stage regardless of the engine used.
+ CounterMetric totalLookup{"query.lookup.pipelineTotalCount"};
+ // Counters for lookup join strategies.
+ CounterMetric nestedLoopJoin{"query.lookup.slotBasedExecutionCounters.nestedLoopJoin"};
+ CounterMetric indexedLoopJoin{"query.lookup.slotBasedExecutionCounters.indexedLoopJoin"};
+ CounterMetric hashLookup{"query.lookup.slotBasedExecutionCounters.hashLookup"};
+ // Counter tracking hashLookup spills in lookup stages that get pushed down.
+ CounterMetric hashLookupSpillToDisk{
+ "query.lookup.slotBasedExecutionCounters.hashLookupSpillToDisk"};
+};
+extern LookupPushdownCounters lookupPushdownCounters;
+
/**
* Generic class for counters of expressions inside various MQL statements.
*/