diff options
author | Jason Carey <jcarey@argv.me> | 2019-01-25 12:54:45 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2019-02-04 14:49:52 -0500 |
commit | 8c157f05ea25f13595734b03b3c5b55cd16d7cd6 (patch) | |
tree | 27cbb691e3cf0dbc014be24eccbbae6f4f269280 /src/mongo/shell | |
parent | 1b1cf52e94c49ca4c6d8ba693e949c2b655e74b5 (diff) | |
download | mongo-8c157f05ea25f13595734b03b3c5b55cd16d7cd6.tar.gz |
SERVER-37823 Server Side Traffic Capture
Adds support for special commands which dump wire protocol traffic to
disk.
Diffstat (limited to 'src/mongo/shell')
-rw-r--r-- | src/mongo/shell/shell_utils_launcher.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp index 58b33fe83aa..5db817fff68 100644 --- a/src/mongo/shell/shell_utils_launcher.cpp +++ b/src/mongo/shell/shell_utils_launcher.cpp @@ -61,6 +61,7 @@ #endif #include "mongo/client/dbclient_connection.h" +#include "mongo/db/traffic_reader.h" #include "mongo/scripting/engine.h" #include "mongo/shell/shell_options.h" #include "mongo/shell/shell_utils.h" @@ -1062,6 +1063,14 @@ BSONObj StopMongoProgramByPid(const BSONObj& a, void* data) { return BSON("" << (double)code); } +BSONObj ConvertTrafficRecordingToBSON(const BSONObj& a, void* data) { + int nFields = a.nFields(); + uassert(ErrorCodes::FailedToParse, "wrong number of arguments", nFields == 1); + + auto arr = trafficRecordingFileToBSONArr(a.firstElement().String()); + return BSON("" << arr); +} + int KillMongoProgramInstances() { vector<ProcessId> pids; registry.getRegisteredPids(pids); @@ -1113,6 +1122,7 @@ void installShellUtilsLauncher(Scope& scope) { scope.injectNative("resetDbpath", ResetDbpath); scope.injectNative("pathExists", PathExists); scope.injectNative("copyDbpath", CopyDbpath); + scope.injectNative("convertTrafficRecordingToBSON", ConvertTrafficRecordingToBSON); } } // namespace shell_utils } // namespace mongo |