From 22315fbe86f5e022f78f401479206cc0c16a2221 Mon Sep 17 00:00:00 2001 From: "J. Emrys Landivar" Date: Tue, 1 Jun 2021 19:53:40 -0500 Subject: [PATCH] fix: null pointer panic in scraper handler (#2564) * fix: null pointer panic in scraper handler * chore: update changelog --- CHANGELOG.md | 3 +++ services/diagnostic/handlers.go | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b41239f84..7212c14cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ - [#2559](https://github.com/influxdata/kapacitor/pull/2559): kapacitor cli supports flux tasks - [#2560](https://github.com/influxdata/kapacitor/pull/2560): enable new-style slack apps +### Bugfixes +- [#2564](https://github.com/influxdata/kapacitor/pull/2564): Fix a panic in the scraper handler when debug mode is enabled + ## v1.5.9 [2021-04-01] ### Bugfixes diff --git a/services/diagnostic/handlers.go b/services/diagnostic/handlers.go index 031db6fe3..4c2b1986f 100644 --- a/services/diagnostic/handlers.go +++ b/services/diagnostic/handlers.go @@ -1005,7 +1005,8 @@ type EC2Handler struct { func (h *EC2Handler) WithClusterContext(cluster string) ec2.Diagnostic { return &EC2Handler{ ScraperHandler: &ScraperHandler{ - l: h.ScraperHandler.l.With(String("cluster_id", cluster)), + l: h.ScraperHandler.l.With(String("cluster_id", cluster)), + buf: &bytes.Buffer{}, }, } } @@ -1266,7 +1267,8 @@ func (h *ScraperHandler) With(key string, value interface{}) plog.Logger { } return &ScraperHandler{ - l: h.l.With(field), + l: h.l.With(field), + buf: &bytes.Buffer{}, } }