summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/watchdog/watchdog_mongod.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/watchdog/watchdog_mongod.cpp b/src/mongo/watchdog/watchdog_mongod.cpp
index 77c87b087b5..793d173e41b 100644
--- a/src/mongo/watchdog/watchdog_mongod.cpp
+++ b/src/mongo/watchdog/watchdog_mongod.cpp
@@ -117,9 +117,13 @@ public:
}
BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const {
- BSONObjBuilder result;
+ if (!watchdogEnabled) {
+ return BSONObj();
+ }
+ BSONObjBuilder result;
WatchdogMonitor* watchdog = getWatchdogMonitor(opCtx->getServiceContext()).get();
+ invariant(watchdog);
result.append("checkGeneration", watchdog->getCheckGeneration());
result.append("monitorGeneration", watchdog->getMonitorGeneration());