summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryomegui <garnaud25@gmail.com>2015-12-23 17:24:45 +0100
committeryomegui <garnaud25@gmail.com>2015-12-23 17:24:45 +0100
commit062f9748bf1d1e13f13672f7e31f9e0f90d6e874 (patch)
tree779065ace54eb0f748e1c2664e94599a8db3015c
parent07dcbd402e0b6b50ea9abd1b4a43d3cfc2d0c5de (diff)
downloadmongo-062f9748bf1d1e13f13672f7e31f9e0f90d6e874.tar.gz
mongostat json has wrong mmapv1-specific fields
The json formatter doesn't display these fields when the engine is WiredTiger: * flushes * ar|aw * qr|qw But these fields are present in grid formatter and documentation doesn't mention that these fields are mmapv1 specific (https://docs.mongodb.org/manual/reference/program/mongostat/). This patch fixes that.
-rw-r--r--mongostat/stat_types.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/mongostat/stat_types.go b/mongostat/stat_types.go
index 11d99ba6044..8b56aa6ee24 100644
--- a/mongostat/stat_types.go
+++ b/mongostat/stat_types.go
@@ -461,15 +461,12 @@ func (jlf *JSONLineFormatter) FormatLines(lines []StatLine, index int, discover
lineJson["host"] = line.Host
lineJson["vsize"] = text.FormatMegabyteAmount(int64(line.Virtual))
lineJson["res"] = text.FormatMegabyteAmount(int64(line.Resident))
-
+ lineJson["flushes"] = fmt.Sprintf("%v", line.Flushes)
+ lineJson["qr|qw"] = fmt.Sprintf("%v|%v", line.QueuedReaders, line.QueuedWriters)
+ lineJson["ar|aw"] = fmt.Sprintf("%v|%v", line.ActiveReaders, line.ActiveWriters)
+
// add mmapv1-specific fields
if lineFlags&MMAPOnly > 0 {
- lineJson["flushes"] = fmt.Sprintf("%v", line.Flushes)
- lineJson["qr|qw"] = fmt.Sprintf("%v|%v", line.QueuedReaders,
- line.QueuedWriters)
- lineJson["ar|aw"] = fmt.Sprintf("%v|%v", line.ActiveReaders,
- line.ActiveWriters)
-
mappedVal := "" // empty for mongos
if line.Mapped > 0 { // not mongos, update accordingly
mappedVal = text.FormatMegabyteAmount(int64(line.Mapped))