Skip to content

Commit

Permalink
add container image for docker metricsets (elastic#8438)
Browse files Browse the repository at this point in the history
* add container image for docker metricsets
  • Loading branch information
Poh Zi How authored and exekias committed Sep 28, 2018
1 parent 4a03bb3 commit e7f50bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff]
- Added `ccr` metricset to Elasticsearch module. {pull}8335[8335]
- Added support for query params in configuration {issue}8286[8286] {pull}8292[8292]
- Support for Kafka 2.0.0 {pull}8399[8399]
- Add container image for docker metricsets. {issue}8214[8214] {pull}8438[8438]

*Packetbeat*

Expand Down
7 changes: 5 additions & 2 deletions metricbeat/module/docker/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ import (
type Container struct {
ID string
Name string
Image string
Labels common.MapStr
}

func (c *Container) ToMapStr() common.MapStr {
m := common.MapStr{
"id": c.ID,
"name": c.Name,
"id": c.ID,
"name": c.Name,
"image": c.Image,
}

if len(c.Labels) > 0 {
Expand All @@ -52,6 +54,7 @@ func NewContainer(container *types.Container, dedot bool) *Container {
ID: container.ID,
Name: ExtractContainerName(container.Names),
Labels: DeDotLabels(container.Labels, dedot),
Image: container.Image,
}
}

Expand Down
5 changes: 3 additions & 2 deletions metricbeat/module/docker/memory/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ func TestMemoryService_GetMemoryStats(t *testing.T) {
expectedEvent := common.MapStr{
"_module": common.MapStr{
"container": common.MapStr{
"id": containerID,
"name": "name1",
"id": containerID,
"name": "name1",
"image": "image",
"labels": common.MapStr{
"label1": "val1",
"label2": common.MapStr{
Expand Down

0 comments on commit e7f50bf

Please sign in to comment.