diff options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/commands/server_status.cpp | 17 | ||||
-rw-r--r-- | src/mongo/db/ftdc/ftdc_server.cpp | 4 |
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 0bf49ea4864..0a58ba53ae0 100644 --- a/src/mongo/db/commands/server_status.cpp +++ b/src/mongo/db/commands/server_status.cpp @@ -48,6 +48,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) {} @@ -152,13 +156,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 5ffb7a126e9..f786ab36c61 100644 --- a/src/mongo/db/ftdc/ftdc_server.cpp +++ b/src/mongo/db/ftdc/ftdc_server.cpp @@ -291,12 +291,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()); |