Skip to content

Commit

Permalink
Remove cont_id tag from docker plugin
Browse files Browse the repository at this point in the history
also renaming cont_name and cont_image to container_name and
container_image.

closes #1014
  • Loading branch information
sparrc committed Apr 12, 2016
1 parent e428d11 commit 9183e6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
5 changes: 2 additions & 3 deletions plugins/inputs/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ func (d *Docker) gatherContainer(
}

tags := map[string]string{
"cont_id": container.ID,
"cont_name": cname,
"cont_image": container.Image,
"container_name": cname,
"container_image": container.Image,
}
if len(d.ContainerNames) > 0 {
if !sliceContains(cname, d.ContainerNames) {
Expand Down
17 changes: 7 additions & 10 deletions plugins/inputs/docker/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ func TestDockerGatherContainerStats(t *testing.T) {
stats := testStats()

tags := map[string]string{
"cont_id": "foobarbaz",
"cont_name": "redis",
"cont_image": "redis/image",
"container_name": "redis",
"container_image": "redis/image",
}
gatherContainerStats(stats, &acc, tags)

Expand Down Expand Up @@ -372,10 +371,9 @@ func TestDockerGatherInfo(t *testing.T) {
"usage_total": uint64(1231652),
},
map[string]string{
"cont_id": "b7dfbb9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296e2173",
"cont_name": "etcd2",
"cont_image": "quay.io/coreos/etcd:v2.2.2",
"cpu": "cpu3",
"container_name": "etcd2",
"container_image": "quay.io/coreos/etcd:v2.2.2",
"cpu": "cpu3",
},
)
acc.AssertContainsTaggedFields(t,
Expand Down Expand Up @@ -417,9 +415,8 @@ func TestDockerGatherInfo(t *testing.T) {
"limit": uint64(18935443456),
},
map[string]string{
"cont_id": "b7dfbb9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296e2173",
"cont_name": "etcd2",
"cont_image": "quay.io/coreos/etcd:v2.2.2",
"container_name": "etcd2",
"container_image": "quay.io/coreos/etcd:v2.2.2",
},
)

Expand Down

0 comments on commit 9183e6a

Please sign in to comment.