Skip to content

Commit

Permalink
apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Jan 29, 2019
1 parent da7f60c commit 67a846b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
51 changes: 26 additions & 25 deletions metricbeat/module/mongodb/status/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"connections": {
"available": 838859,
"current": 1,
"total_created": 426
"total_created": 35
},
"extra_info": {
"heap_usage": {},
Expand All @@ -42,15 +42,15 @@
"writers": 0
},
"total_time": {
"us": 449113000
"us": 34179000
}
},
"local_time": "2019-01-28T12:50:28.255Z",
"local_time": "2019-01-29T07:39:59.092Z",
"locks": {
"collection": {
"acquire": {
"count": {
"r": 232,
"r": 24,
"w": 2
}
},
Expand All @@ -62,7 +62,7 @@
"count": {
"R": 1,
"W": 7,
"r": 232
"r": 24
}
},
"deadlock": {},
Expand All @@ -72,7 +72,7 @@
"acquire": {
"count": {
"W": 3,
"r": 955,
"r": 100,
"w": 7
}
},
Expand All @@ -98,24 +98,24 @@
"mb": 0
},
"resident": {
"mb": 59
"mb": 58
},
"virtual": {
"mb": 930
"mb": 928
}
},
"network": {
"in": {
"bytes": 3712
"bytes": 928
},
"out": {
"bytes": 358612
"bytes": 71994
},
"requests": 127
"requests": 31
},
"ops": {
"counters": {
"command": 64,
"command": 16,
"delete": 0,
"getmore": 0,
"insert": 0,
Expand All @@ -124,8 +124,8 @@
},
"latencies": {
"commands": {
"count": 63,
"latency": 7480
"count": 15,
"latency": 1903
},
"reads": {
"count": 0,
Expand All @@ -145,28 +145,27 @@
"update": 0
}
},
"process": "mongod",
"storage_engine": {
"name": "wiredTiger"
},
"uptime": {
"ms": 449112
"ms": 34175
},
"wired_tiger": {
"cache": {
"dirty": {
"bytes": 0
"bytes": 19612
},
"maximum": {
"bytes": 2057306112
},
"pages": {
"evicted": 0,
"read": 0,
"write": 20
"write": 0
},
"used": {
"bytes": 29670
"bytes": 21099
}
},
"concurrent_transactions": {
Expand All @@ -182,26 +181,28 @@
}
},
"log": {
"flushes": 4472,
"flushes": 340,
"max_file_size": {
"bytes": 104857600
},
"scans": 0,
"size": {
"bytes": 33554432
},
"syncs": 15,
"syncs": 11,
"write": {
"bytes": 17664
"bytes": 14848
},
"writes": 45
"writes": 39
}
}
}
},
"process": {
"name": "mongod"
},
"service": {
"address": "127.0.0.1:27017",
"type": "mongodb",
"version": "3.4.19"
"type": "mongodb"
}
}
5 changes: 5 additions & 0 deletions metricbeat/module/mongodb/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) {
event.RootFields.Put("service.version", v)
event.MetricSetFields.Delete("version")
}
if v, err := event.MetricSetFields.GetValue("process"); err == nil {
event.RootFields = common.MapStr{}
event.RootFields.Put("process.name", v)
event.MetricSetFields.Delete("process")
}
r.Event(event)
}
10 changes: 5 additions & 5 deletions metricbeat/module/mongodb/status/status_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ func TestFetch(t *testing.T) {
}

t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(),
events[0].BeatEvent("haproxy", "status").Fields.StringToPrint())
events[0].BeatEvent("mongodb", "status").Fields.StringToPrint())

event := events[0].BeatEvent("haproxy", "status").Fields
event := events[0].BeatEvent("mongodb", "status").Fields

// Check event fields
current, _ := event.GetValue("haproxy.status.connections.current")
current, _ := event.GetValue("mongodb.status.connections.current")
assert.True(t, current.(int64) >= 0)

available, _ := event.GetValue("haproxy.status.connections.available")
available, _ := event.GetValue("mongodb.status.connections.available")
assert.True(t, available.(int64) > 0)

pageFaults, _ := event.GetValue("haproxy.status.extra_info.page_faults")
pageFaults, _ := event.GetValue("mongodb.status.extra_info.page_faults")
assert.True(t, pageFaults.(int64) >= 0)
}

Expand Down

0 comments on commit 67a846b

Please sign in to comment.