Skip to content

Metricbeat docker diskio module bug #5568

@kwojcicki

Description

@kwojcicki
  • Version:
    Any with docker diskio module
  • Operating System:
    Any
  • Steps to Reproduce:
    Start 2+ containers check the docker diskio statistics pushed. The stats will always be 0 due to a bug in the code.

There is a bug in /metricbeat/module/docker/diskio/help.go that resets the map of containers if a old stats for a container arent found.

func (io *BLkioService) getBlkioStats(myRawStat *docker.Stat) BlkioStats {
......
       if exist {
		myBlkioStats.reads = io.getReadPs(&oldBlkioStats, &newBlkioStats)
		myBlkioStats.writes = io.getWritePs(&oldBlkioStats, &newBlkioStats)
		myBlkioStats.totals = io.getTotalPs(&oldBlkioStats, &newBlkioStats)
	} else {
		io.BlkioSTatsPerContainer = make(map[string]BlkioRaw)
	}

If there are 2+ containers then the map will be reset over and over again ie:
getBlkioStats gets called for first container
old stats for first container dont exist, map reset, container1 placed into map
getBlkioStats gets called for second container
old stats for second container dont exist, map resets, container2 placed into map

rinse and repeat. I have a code fix + tests not sure if I should push into master or into a lower release and cherry pick into higher releases as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions