diff options
author | Mihai Andrei <mihai.andrei@mongodb.com> | 2020-01-29 15:13:38 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-19 22:44:37 +0000 |
commit | c54a777a4a154984f5595b11993d7d009350a38c (patch) | |
tree | b709682805f4ebc99aab698beeeefc83427668d9 /src/mongo/db/pipeline/lite_parsed_pipeline.cpp | |
parent | d8810b45d790ebce228ff484dfc27494aadd2c6b (diff) | |
download | mongo-c54a777a4a154984f5595b11993d7d009350a38c.tar.gz |
SERVER-44689 Add serverStatus counter for each use of an aggregation stage in a user's request
Diffstat (limited to 'src/mongo/db/pipeline/lite_parsed_pipeline.cpp')
-rw-r--r-- | src/mongo/db/pipeline/lite_parsed_pipeline.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/lite_parsed_pipeline.cpp b/src/mongo/db/pipeline/lite_parsed_pipeline.cpp index 954239fa928..153912ef448 100644 --- a/src/mongo/db/pipeline/lite_parsed_pipeline.cpp +++ b/src/mongo/db/pipeline/lite_parsed_pipeline.cpp @@ -32,6 +32,7 @@ #include "mongo/db/pipeline/lite_parsed_pipeline.h" #include "mongo/db/operation_context.h" +#include "mongo/db/stats/counters.h" namespace mongo { @@ -110,4 +111,17 @@ void LiteParsedPipeline::verifyIsSupported( } } +void LiteParsedPipeline::tickGlobalStageCounters() const { + for (auto&& stage : _stageSpecs) { + // Tick counter corresponding to current stage. + aggStageCounters.stageCounterMap.find(stage->getParseTimeName()) + ->second->counter.increment(1); + + // Recursively step through any sub-pipelines. + for (auto&& subPipeline : stage->getSubPipelines()) { + subPipeline.tickGlobalStageCounters(); + } + } +} + } // namespace mongo |