summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2018-10-11 14:21:13 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 00:31:30 +0000
commita411d4c1c47a2ec38bcc856007538695c0fcc2a9 (patch)
treee8b46679c6507b296b29e9879b248bf532e6e953
parenta891f6f252549ea064c9925ba9a12a20ca8064c6 (diff)
downloadmongo-a411d4c1c47a2ec38bcc856007538695c0fcc2a9.tar.gz
SERVER-34199 Remove serverStatus timing section from FTDC
(cherry picked from commit a222ef5e647ac527f7d4f8636bcacd6cc0ae6b8e)
-rw-r--r--src/mongo/db/commands/server_status.cpp17
-rw-r--r--src/mongo/db/ftdc/ftdc_server.cpp4
2 files changed, 19 insertions, 2 deletions
diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp
index c5ad8e0d207..056c56ec8f6 100644
--- a/src/mongo/db/commands/server_status.cpp
+++ b/src/mongo/db/commands/server_status.cpp
@@ -67,6 +67,10 @@ using std::map;
using std::string;
using std::stringstream;
+namespace {
+constexpr auto kTimingSection = "timing"_sd;
+} // namespace
+
class CmdServerStatus : public BasicCommand {
public:
CmdServerStatus() : BasicCommand("serverStatus"), _started(Date_t::now()), _runCalled(false) {}
@@ -171,13 +175,24 @@ public:
if (runElapsed > Milliseconds(1000)) {
BSONObj t = timeBuilder.obj();
log() << "serverStatus was very slow: " << t;
- result.append("timing", t);
+
+ bool include_timing = true;
+ const auto& elem = cmdObj[kTimingSection];
+ if (!elem.eoo()) {
+ include_timing = elem.trueValue();
+ }
+
+ if (include_timing) {
+ result.append(kTimingSection, t);
+ }
}
return true;
}
void addSection(ServerStatusSection* section) {
+ // Disallow adding a section named "timing" as it is reserved for the server status command.
+ dassert(section->getSectionName() != kTimingSection);
verify(!_runCalled);
_sections[section->getSectionName()] = section;
}
diff --git a/src/mongo/db/ftdc/ftdc_server.cpp b/src/mongo/db/ftdc/ftdc_server.cpp
index c8caad03892..5b22121f58f 100644
--- a/src/mongo/db/ftdc/ftdc_server.cpp
+++ b/src/mongo/db/ftdc/ftdc_server.cpp
@@ -293,12 +293,14 @@ void startFTDC(boost::filesystem::path& path,
// migration status. This section triggers too many schema changes in the serverStatus which
// hurt ftdc compression efficiency, because its output varies depending on the list of active
// migrations.
+ // "timing" is filtered out because it triggers frequent schema changes.
// TODO: do we need to enable "sharding" on MongoS?
controller->addPeriodicCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>(
"serverStatus",
"serverStatus",
"",
- BSON("serverStatus" << 1 << "tcMalloc" << true << "sharding" << false)));
+ BSON("serverStatus" << 1 << "tcMalloc" << true << "sharding" << false << "timing"
+ << false)));
registerCollectors(controller.get());