Skip to content

Commit

Permalink
Add review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Oct 5, 2016
1 parent 1bdf7bb commit 8c06ee8
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 41 deletions.
8 changes: 5 additions & 3 deletions metricbeat/beater/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
defaultType = "metricsets"
)

// eventBuilder is used for building MetricSet events. MetricSets generate a
// EventBuilder is used for building MetricSet events. MetricSets generate a
// data in the form of a common.MapStr. This builder transforms that data into
// a complete event and applies any Module-level filtering.
type EventBuilder struct {
Expand All @@ -27,7 +27,7 @@ type EventBuilder struct {
metadata common.EventMetadata
}

// build builds an event from MetricSet data and applies the Module-level
// Build builds an event from MetricSet data and applies the Module-level
// filters.
func (b EventBuilder) Build() (common.MapStr, error) {
// event may be nil when there was an error fetching.
Expand Down Expand Up @@ -71,7 +71,9 @@ func (b EventBuilder) Build() (common.MapStr, error) {

// In case meta data exists, it is added on the module level
if moudleDataExists {
event[b.ModuleName].(common.MapStr).Update(moduleData.(common.MapStr))
if _, ok := event[b.ModuleName].(common.MapStr); ok {
event[b.ModuleName].(common.MapStr).Update(moduleData.(common.MapStr))
}
}

// Overwrite default index if set.
Expand Down
38 changes: 30 additions & 8 deletions metricbeat/module/docker/container/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,60 @@
"@timestamp": "2016-05-23T08:05:34.853Z",
"docker": {
"container": {
"command": "/go/src/github.com/elastic/beats/libbeat/scripts/docker-entrypoint.sh make system-tests",
"created": "2016-10-05T12:19:25.000Z",
"id": "33a924f09bc9fc7dfb66cb479904e362ae1df341b2d832040c54bfe4770e3f28",
"image": "environments_beat",
"command": "/entrypoint.sh /bin/sh -c 'logstash -f /logstash.conf --log.level=debug --config.debug'",
"created": "2016-10-05T13:33:37.000Z",
"id": "7e29f4a1b2c0dd13af7c725d8deb342a36ed170eac977c183da70ef266513202",
"image": "environments_logstash",
"labels": [
{
"key": "com_docker_compose_config-hash",
"value": "62a912f01b02c0673332badedfcb092977d8dba2ca1115448a2674218ae1af5a"
},
{
"key": "com_docker_compose_container-number",
"value": "1"
},
{
"key": "com_docker_compose_oneoff",
"value": "True"
"value": "False"
},
{
"key": "com_docker_compose_project",
"value": "environments"
},
{
"key": "com_docker_compose_service",
"value": "beat"
"value": "logstash"
},
{
"key": "com_docker_compose_version",
"value": "1.8.1"
}
],
"name": "environments_beat_run_1",
"name": "logstash",
"ports": [
{
"ip": "",
"port": {
"private": 5055,
"public": 0
},
"type": "tcp"
},
{
"ip": "",
"port": {
"private": 5044,
"public": 0
},
"type": "tcp"
}
],
"size": {
"root_fs": 0,
"rw": 0
},
"status": "Up 33 seconds"
"status": "Up 21 minutes"
}
},
"metricset": {
Expand Down
20 changes: 12 additions & 8 deletions metricbeat/module/docker/cpu/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,45 @@
"@timestamp": "2016-05-23T08:05:34.853Z",
"docker": {
"container": {
"id": "33a924f09bc9fc7dfb66cb479904e362ae1df341b2d832040c54bfe4770e3f28",
"id": "7e29f4a1b2c0dd13af7c725d8deb342a36ed170eac977c183da70ef266513202",
"labels": [
{
"key": "com_docker_compose_config-hash",
"value": "62a912f01b02c0673332badedfcb092977d8dba2ca1115448a2674218ae1af5a"
},
{
"key": "com_docker_compose_container-number",
"value": "1"
},
{
"key": "com_docker_compose_oneoff",
"value": "True"
"value": "False"
},
{
"key": "com_docker_compose_project",
"value": "environments"
},
{
"key": "com_docker_compose_service",
"value": "beat"
"value": "logstash"
},
{
"key": "com_docker_compose_version",
"value": "1.8.1"
}
],
"name": "environments_beat_run_1",
"name": "logstash",
"socket": "unix:///var/run/docker.sock"
},
"cpu": {
"usage": {
"kernel_mode": 0.01,
"per_cpu": {
"0": 0.002353412,
"1": 0.0064889
"0": 0.009357942,
"1": 0.01215135
},
"total": 0.008842312,
"user_mode": 0
"total": 0.021509292,
"user_mode": 0.01
}
}
},
Expand Down
12 changes: 8 additions & 4 deletions metricbeat/module/docker/diskio/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
"@timestamp": "2016-05-23T08:05:34.853Z",
"docker": {
"container": {
"id": "33a924f09bc9fc7dfb66cb479904e362ae1df341b2d832040c54bfe4770e3f28",
"id": "7e29f4a1b2c0dd13af7c725d8deb342a36ed170eac977c183da70ef266513202",
"labels": [
{
"key": "com_docker_compose_config-hash",
"value": "62a912f01b02c0673332badedfcb092977d8dba2ca1115448a2674218ae1af5a"
},
{
"key": "com_docker_compose_container-number",
"value": "1"
},
{
"key": "com_docker_compose_oneoff",
"value": "True"
"value": "False"
},
{
"key": "com_docker_compose_project",
"value": "environments"
},
{
"key": "com_docker_compose_service",
"value": "beat"
"value": "logstash"
},
{
"key": "com_docker_compose_version",
"value": "1.8.1"
}
],
"name": "environments_beat_run_1",
"name": "logstash",
"socket": "unix:///var/run/docker.sock"
},
"diskio": {
Expand Down
10 changes: 5 additions & 5 deletions metricbeat/module/docker/info/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"info": {
"containers": {
"paused": 0,
"running": 6,
"stopped": 3,
"total": 9
"running": 11,
"stopped": 1,
"total": 12
},
"id": "72D7:ZROM:4ZNR:GOAB:OSHR:WCN4:UF7W:WVY2:MN36:Y24M:YUZS:4PER",
"images": 790
"id": "CRDS:UHQ6:W3IR:GROZ:IUG3:VS2E:4QJJ:FJWG:PRQ4:R25R:VNNP:NE62",
"images": 119
}
},
"metricset": {
Expand Down
22 changes: 13 additions & 9 deletions metricbeat/module/docker/memory/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
"@timestamp": "2016-05-23T08:05:34.853Z",
"docker": {
"container": {
"id": "33a924f09bc9fc7dfb66cb479904e362ae1df341b2d832040c54bfe4770e3f28",
"id": "7e29f4a1b2c0dd13af7c725d8deb342a36ed170eac977c183da70ef266513202",
"labels": [
{
"key": "com_docker_compose_config-hash",
"value": "62a912f01b02c0673332badedfcb092977d8dba2ca1115448a2674218ae1af5a"
},
{
"key": "com_docker_compose_container-number",
"value": "1"
},
{
"key": "com_docker_compose_oneoff",
"value": "True"
"value": "False"
},
{
"key": "com_docker_compose_project",
"value": "environments"
},
{
"key": "com_docker_compose_service",
"value": "beat"
"value": "logstash"
},
{
"key": "com_docker_compose_version",
"value": "1.8.1"
}
],
"name": "environments_beat_run_1",
"name": "logstash",
"socket": "unix:///var/run/docker.sock"
},
"memory": {
Expand All @@ -34,13 +38,13 @@
},
"limit": 4139544576,
"rss": {
"pct": 0.00012566406532156643,
"total": 520192
"pct": 0.10530747622030197,
"total": 435924992
},
"usage": {
"max": 5410816,
"pct": 0.0009597964044245625,
"total": 3973120
"max": 465604608,
"pct": 0.11162827975789383,
"total": 462090240
}
}
},
Expand Down
12 changes: 8 additions & 4 deletions metricbeat/module/docker/network/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
"@timestamp": "2016-05-23T08:05:34.853Z",
"docker": {
"container": {
"id": "33a924f09bc9fc7dfb66cb479904e362ae1df341b2d832040c54bfe4770e3f28",
"id": "7e29f4a1b2c0dd13af7c725d8deb342a36ed170eac977c183da70ef266513202",
"labels": [
{
"key": "com_docker_compose_config-hash",
"value": "62a912f01b02c0673332badedfcb092977d8dba2ca1115448a2674218ae1af5a"
},
{
"key": "com_docker_compose_container-number",
"value": "1"
},
{
"key": "com_docker_compose_oneoff",
"value": "True"
"value": "False"
},
{
"key": "com_docker_compose_project",
"value": "environments"
},
{
"key": "com_docker_compose_service",
"value": "beat"
"value": "logstash"
},
{
"key": "com_docker_compose_version",
"value": "1.8.1"
}
],
"name": "environments_beat_run_1",
"name": "logstash",
"socket": "unix:///var/run/docker.sock"
},
"network": {
Expand Down

0 comments on commit 8c06ee8

Please sign in to comment.