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:36:56 +0000
commitc256da787a986f3adf2096306a68e782f62a3113 (patch)
treec6f932e0e0749372c76ca1115e28838bf7373aba
parent082c6e1f1eb6db5e54a07500dbd26a6d1cdfd0ff (diff)
downloadmongo-c256da787a986f3adf2096306a68e782f62a3113.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 89eae376373..01fd9569fc4 100644
--- a/src/mongo/db/commands/server_status.cpp
+++ b/src/mongo/db/commands/server_status.cpp
@@ -50,6 +50,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) {}
@@ -154,13 +158,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 95eb2b21b83..a46a0106262 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());