From 7a24c05b67fe4e219dcaccced2c63e304409575c Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 29 Aug 2019 22:37:18 +0200 Subject: [PATCH 1/2] Fix panic in Redis key metricset 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. --- CHANGELOG.next.asciidoc | 1 + metricbeat/module/redis/key/key.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 84c0d61fc29b..0fa135cde764 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -179,6 +179,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix redis key metricset dashboard references to index pattern. {pull}13303[13303] - Check if fields in DBInstance is nil in rds metricset. {pull}13294[13294] {issue}13037[13037] - Fix silent failures in kafka and prometheus module. {pull}13353[13353] {issue}13252[13252] +- Fix panic in Redis Key metricset when collecting information from a removed key. {pull}[] *Packetbeat* diff --git a/metricbeat/module/redis/key/key.go b/metricbeat/module/redis/key/key.go index d82e994621e3..6eab8d0aeaaf 100644 --- a/metricbeat/module/redis/key/key.go +++ b/metricbeat/module/redis/key/key.go @@ -112,6 +112,10 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { r.Error(err) continue } + if keyInfo == nil { + m.Logger().Debugf("Ignoring removed key %s from keyspace %d", key, keyspace) + continue + } event := eventMapping(keyspace, keyInfo) if !r.Event(event) { m.Logger().Debug("Failed to report event, interrupting fetch") From 0b96e8f7fec70296daf1ce5aa677d7a5607fbc51 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 29 Aug 2019 22:45:00 +0200 Subject: [PATCH 2/2] Fix changelog --- CHANGELOG.next.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 0fa135cde764..f4f376a61e7b 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -179,7 +179,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix redis key metricset dashboard references to index pattern. {pull}13303[13303] - Check if fields in DBInstance is nil in rds metricset. {pull}13294[13294] {issue}13037[13037] - Fix silent failures in kafka and prometheus module. {pull}13353[13353] {issue}13252[13252] -- Fix panic in Redis Key metricset when collecting information from a removed key. {pull}[] +- Fix panic in Redis Key metricset when collecting information from a removed key. {pull}13426[13426] *Packetbeat*