Skip to content

Commit

Permalink
Fix panic in Redis key metricset (elastic#13426)
Browse files Browse the repository at this point in the history
If a key is removed during a fetch, `FetchKeyInfo` returns a nil object,
this nil object should be ignored, if passed to `eventMapping` it
panics.

(cherry picked from commit 99ded55)
  • Loading branch information
jsoriano committed Aug 30, 2019
1 parent 24ae043 commit fd85b0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Expand Up @@ -46,6 +46,8 @@ https://github.com/elastic/beats/compare/v6.8.0...6.8.1[Check the HEAD diff]

*Metricbeat*

- Fix panic in Redis Key metricset when collecting information from a removed key. {pull}13426[13426]

*Packetbeat*

*Winlogbeat*
Expand Down
4 changes: 4 additions & 0 deletions metricbeat/module/redis/key/key.go
Expand Up @@ -95,6 +95,10 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) {
logp.Err("Failed to fetch key info for key %s in keyspace %d", key, p.Keyspace)
continue
}
if keyInfo == nil {
debugf("Ignoring removed key %s from keyspace %d", key, p.Keyspace)
continue
}
event := eventMapping(p.Keyspace, keyInfo)
if !r.Event(event) {
debugf("Failed to report event, interrupting Fetch")
Expand Down

0 comments on commit fd85b0d

Please sign in to comment.