From 8c06ee80c383691f66ca90975530050f09d8c921 Mon Sep 17 00:00:00 2001 From: ruflin Date: Wed, 5 Oct 2016 15:55:34 +0200 Subject: [PATCH] Add review feedback --- metricbeat/beater/event.go | 8 ++-- .../module/docker/container/_meta/data.json | 38 +++++++++++++++---- metricbeat/module/docker/cpu/_meta/data.json | 20 ++++++---- .../module/docker/diskio/_meta/data.json | 12 ++++-- metricbeat/module/docker/info/_meta/data.json | 10 ++--- .../module/docker/memory/_meta/data.json | 22 ++++++----- .../module/docker/network/_meta/data.json | 12 ++++-- 7 files changed, 81 insertions(+), 41 deletions(-) diff --git a/metricbeat/beater/event.go b/metricbeat/beater/event.go index 37b30cc1ce16..c5b56408ecd9 100644 --- a/metricbeat/beater/event.go +++ b/metricbeat/beater/event.go @@ -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 { @@ -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. @@ -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. diff --git a/metricbeat/module/docker/container/_meta/data.json b/metricbeat/module/docker/container/_meta/data.json index 0ae196f09f88..ce9360b265f2 100644 --- a/metricbeat/module/docker/container/_meta/data.json +++ b/metricbeat/module/docker/container/_meta/data.json @@ -2,18 +2,22 @@ "@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", @@ -21,19 +25,37 @@ }, { "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": { diff --git a/metricbeat/module/docker/cpu/_meta/data.json b/metricbeat/module/docker/cpu/_meta/data.json index ec7b801cee92..b0170e984c2d 100644 --- a/metricbeat/module/docker/cpu/_meta/data.json +++ b/metricbeat/module/docker/cpu/_meta/data.json @@ -2,15 +2,19 @@ "@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", @@ -18,25 +22,25 @@ }, { "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 } } }, diff --git a/metricbeat/module/docker/diskio/_meta/data.json b/metricbeat/module/docker/diskio/_meta/data.json index 7420fb120c00..794e73ad71d8 100644 --- a/metricbeat/module/docker/diskio/_meta/data.json +++ b/metricbeat/module/docker/diskio/_meta/data.json @@ -2,15 +2,19 @@ "@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", @@ -18,14 +22,14 @@ }, { "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": { diff --git a/metricbeat/module/docker/info/_meta/data.json b/metricbeat/module/docker/info/_meta/data.json index 64cb654cb57e..184e424507ae 100644 --- a/metricbeat/module/docker/info/_meta/data.json +++ b/metricbeat/module/docker/info/_meta/data.json @@ -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": { diff --git a/metricbeat/module/docker/memory/_meta/data.json b/metricbeat/module/docker/memory/_meta/data.json index f77dca451b08..132617d71cf9 100644 --- a/metricbeat/module/docker/memory/_meta/data.json +++ b/metricbeat/module/docker/memory/_meta/data.json @@ -2,15 +2,19 @@ "@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", @@ -18,14 +22,14 @@ }, { "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": { @@ -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 } } }, diff --git a/metricbeat/module/docker/network/_meta/data.json b/metricbeat/module/docker/network/_meta/data.json index 8d8cb4d34f59..5cbc52da2a59 100644 --- a/metricbeat/module/docker/network/_meta/data.json +++ b/metricbeat/module/docker/network/_meta/data.json @@ -2,15 +2,19 @@ "@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", @@ -18,14 +22,14 @@ }, { "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": {