summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhong Zhang <yuhong.zhang@mongodb.com>2023-05-15 20:12:40 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-16 19:41:57 +0000
commitf05053d2cb65b84eaed4db94c25e9fe4be82d78c (patch)
tree93d3bf026801c3ff2686decade2be43da1c9e08b
parent9067d947c9c75146ea889f334e5c5cd17e94baba (diff)
downloadmongo-f05053d2cb65b84eaed4db94c25e9fe4be82d78c.tar.gz
SERVER-77151 Add a helper to merge in a collection's bucket catalog execution stats
-rw-r--r--src/mongo/db/timeseries/bucket_catalog/execution_stats.cpp31
-rw-r--r--src/mongo/db/timeseries/bucket_catalog/execution_stats.h6
2 files changed, 37 insertions, 0 deletions
diff --git a/src/mongo/db/timeseries/bucket_catalog/execution_stats.cpp b/src/mongo/db/timeseries/bucket_catalog/execution_stats.cpp
index 174a15fa9ec..bdf4199fd97 100644
--- a/src/mongo/db/timeseries/bucket_catalog/execution_stats.cpp
+++ b/src/mongo/db/timeseries/bucket_catalog/execution_stats.cpp
@@ -201,5 +201,36 @@ void appendExecutionStatsToBuilder(const ExecutionStats& stats, BSONObjBuilder&
}
}
+void addCollectionExecutionStats(ExecutionStatsController stats, const ExecutionStats& collStats) {
+ stats.incNumBucketInserts(collStats.numBucketInserts.load());
+ stats.incNumBucketUpdates(collStats.numBucketUpdates.load());
+ stats.incNumBucketsOpenedDueToMetadata(collStats.numBucketsOpenedDueToMetadata.load());
+ stats.incNumBucketsClosedDueToCount(collStats.numBucketsClosedDueToCount.load());
+ stats.incNumBucketsClosedDueToSchemaChange(collStats.numBucketsClosedDueToSchemaChange.load());
+ stats.incNumBucketsClosedDueToSize(collStats.numBucketsClosedDueToSize.load());
+ stats.incNumBucketsClosedDueToCachePressure(
+ collStats.numBucketsClosedDueToCachePressure.load());
+ stats.incNumBucketsClosedDueToTimeForward(collStats.numBucketsClosedDueToTimeForward.load());
+ stats.incNumBucketsClosedDueToTimeBackward(collStats.numBucketsClosedDueToTimeBackward.load());
+ stats.incNumBucketsClosedDueToMemoryThreshold(
+ collStats.numBucketsClosedDueToMemoryThreshold.load());
+ stats.incNumBucketsClosedDueToReopening(collStats.numBucketsClosedDueToReopening.load());
+ stats.incNumBucketsArchivedDueToMemoryThreshold(
+ collStats.numBucketsArchivedDueToMemoryThreshold.load());
+ stats.incNumBucketsArchivedDueToTimeBackward(
+ collStats.numBucketsArchivedDueToTimeBackward.load());
+ stats.incNumCommits(collStats.numCommits.load());
+ stats.incNumWaits(collStats.numWaits.load());
+ stats.incNumMeasurementsCommitted(collStats.numMeasurementsCommitted.load());
+ stats.incNumBucketsReopened(collStats.numBucketsReopened.load());
+ stats.incNumBucketsKeptOpenDueToLargeMeasurements(
+ collStats.numBucketsKeptOpenDueToLargeMeasurements.load());
+ stats.incNumBucketsFetched(collStats.numBucketsFetched.load());
+ stats.incNumBucketsQueried(collStats.numBucketsQueried.load());
+ stats.incNumBucketFetchesFailed(collStats.numBucketFetchesFailed.load());
+ stats.incNumBucketQueriesFailed(collStats.numBucketQueriesFailed.load());
+ stats.incNumBucketReopeningsFailed(collStats.numBucketReopeningsFailed.load());
+ stats.incNumDuplicateBucketsReopened(collStats.numDuplicateBucketsReopened.load());
+}
} // namespace mongo::timeseries::bucket_catalog
diff --git a/src/mongo/db/timeseries/bucket_catalog/execution_stats.h b/src/mongo/db/timeseries/bucket_catalog/execution_stats.h
index 5b2b00c990a..4a29f271b45 100644
--- a/src/mongo/db/timeseries/bucket_catalog/execution_stats.h
+++ b/src/mongo/db/timeseries/bucket_catalog/execution_stats.h
@@ -103,4 +103,10 @@ private:
void appendExecutionStatsToBuilder(const ExecutionStats& stats, BSONObjBuilder& builder);
+/**
+ * Adds the execution stats of a collection to both the collection and global stats of an execution
+ * stats controller.
+ */
+void addCollectionExecutionStats(ExecutionStatsController stats, const ExecutionStats& collStats);
+
} // namespace mongo::timeseries::bucket_catalog