summaryrefslogtreecommitdiff
path: root/src/mongo/db/server_options_helpers.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2018-03-21 15:55:28 -0400
committerDavid Storch <david.storch@10gen.com>2018-03-22 13:02:57 -0400
commite881661be28902f18139ad8b831e0885135387ca (patch)
tree494102c74e18aa9e225123c670861f7606cda9f4 /src/mongo/db/server_options_helpers.cpp
parente11d931c36605ea6616b57662b723a51aea01478 (diff)
downloadmongo-e881661be28902f18139ad8b831e0885135387ca.tar.gz
SERVER-34017 Add slowms and slowOpSampleRate startup configuration for mongos.
These options can now be set on the command line when starting mongos, or in a mongos config file, in the exact same way that they can be set for a mongod.
Diffstat (limited to 'src/mongo/db/server_options_helpers.cpp')
-rw-r--r--src/mongo/db/server_options_helpers.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index c521a8921ab..b3e25106d89 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -421,6 +421,20 @@ Status addGeneralServerOptions(moe::OptionSection* options) {
.hidden()
.setSources(moe::SourceAllLegacy);
+ options
+ ->addOptionChaining("operationProfiling.slowOpThresholdMs",
+ "slowms",
+ moe::Int,
+ "value of slow for profile and console log")
+ .setDefault(moe::Value(100));
+
+ options
+ ->addOptionChaining("operationProfiling.slowOpSampleRate",
+ "slowOpSampleRate",
+ moe::Double,
+ "fraction of slow ops to include in the profile and console log")
+ .setDefault(moe::Value(1.0));
+
auto ret = addMessageCompressionOptions(options, false);
if (!ret.isOK()) {
return ret;
@@ -1086,6 +1100,15 @@ Status storeServerOptions(const moe::Environment& params) {
return Status(ErrorCodes::BadValue,
"--transitionToAuth must be used with keyFile or x509 authentication");
}
+
+ if (params.count("operationProfiling.slowOpThresholdMs")) {
+ serverGlobalParams.slowMS = params["operationProfiling.slowOpThresholdMs"].as<int>();
+ }
+
+ if (params.count("operationProfiling.slowOpSampleRate")) {
+ serverGlobalParams.sampleRate = params["operationProfiling.slowOpSampleRate"].as<double>();
+ }
+
#ifdef MONGO_CONFIG_SSL
ret = storeSSLServerOptions(params);
if (!ret.isOK()) {