summaryrefslogtreecommitdiff
path: root/src/mongo/db/stats/resource_consumption_metrics.h
diff options
context:
space:
mode:
authorBrian DeLeonardis <brian.deleonardis@mongodb.com>2020-11-04 21:12:00 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-12 01:45:39 +0000
commitd91d8ef3fbb1cb6bd164c5da97d2651318d36041 (patch)
tree122029d49c05e46a848e03af206cad5d47c91a91 /src/mongo/db/stats/resource_consumption_metrics.h
parent990e7bab42431fed082b4d909220494be577d495 (diff)
downloadmongo-d91d8ef3fbb1cb6bd164c5da97d2651318d36041.tar.gz
SERVER-51724 Collect the number of cursor seeks per operation
Diffstat (limited to 'src/mongo/db/stats/resource_consumption_metrics.h')
-rw-r--r--src/mongo/db/stats/resource_consumption_metrics.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/stats/resource_consumption_metrics.h b/src/mongo/db/stats/resource_consumption_metrics.h
index 5e49b6f5f9a..9ca51be3fa8 100644
--- a/src/mongo/db/stats/resource_consumption_metrics.h
+++ b/src/mongo/db/stats/resource_consumption_metrics.h
@@ -60,6 +60,7 @@ public:
idxEntryUnitsRead += other.idxEntryUnitsRead;
keysSorted += other.keysSorted;
docUnitsReturned += other.docUnitsReturned;
+ cursorSeeks += other.cursorSeeks;
}
ReadMetrics& operator+=(const ReadMetrics& other) {
@@ -84,6 +85,8 @@ public:
long long keysSorted = 0;
// Number of document units returned by a query
long long docUnitsReturned = 0;
+ // Number of cursor seeks
+ long long cursorSeeks = 0;
};
/* WriteMetrics maintains metrics for write operations. */
@@ -277,6 +280,14 @@ public:
*/
void incrementOneIdxEntryWritten(size_t idxEntryBytesWritten);
+ /**
+ * This should be called once every time the storage engine successfully does a cursor seek.
+ * Note that if it takes multiple attempts to do a successful seek, this function should
+ * only be called once. If the seek does not find anything, this function should not be
+ * called.
+ */
+ void incrementOneCursorSeek();
+
private:
/**
* Helper function that calls the Func when this collector is currently collecting metrics.