Skip to content

Commit

Permalink
Fix panic on docker healthcheck collection (elastic#9171)
Browse files Browse the repository at this point in the history
Fix panic on docker healthcheck collection on dockers without healthchecks.

(cherry picked from commit 1c43d6c)
  • Loading branch information
jsoriano committed Nov 20, 2018
1 parent f49b928 commit e23093e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ https://github.com/elastic/beats/compare/v6.5.1...6.5[Check the HEAD diff]

*Metricbeat*

- Fix panic on docker healthcheck collection on dockers without healthchecks. {pull}9171[9171]

*Packetbeat*

*Winlogbeat*
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/docker/healthcheck/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ func eventMapping(cont *types.Container, m *MetricSet) common.MapStr {
logp.Err("Error inspecting container %v: %v", cont.ID, err)
return nil
}

// Check if the container has any health check
if container.State.Health == nil {
return nil
}

lastEvent := len(container.State.Health.Log) - 1

// Checks if a healthcheck already happened
Expand Down

0 comments on commit e23093e

Please sign in to comment.