From ccad651a61be755140b47dd53077f3ae57aa9ec1 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 13 Sep 2022 19:36:47 +0300 Subject: [PATCH] lib/promscrape/discovery/kubernetes: add more context on WatchEvent parse error This should improve debugging issues with Kubernetes API server --- lib/promscrape/discovery/kubernetes/api_watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/promscrape/discovery/kubernetes/api_watcher.go b/lib/promscrape/discovery/kubernetes/api_watcher.go index ad6ba53a2..973b10a51 100644 --- a/lib/promscrape/discovery/kubernetes/api_watcher.go +++ b/lib/promscrape/discovery/kubernetes/api_watcher.go @@ -702,7 +702,7 @@ func (uw *urlWatcher) readObjectUpdateStream(r io.Reader) error { var we WatchEvent for { if err := d.Decode(&we); err != nil { - return err + return fmt.Errorf("cannot parse WatchEvent json response: %s", err) } switch we.Type { case "ADDED", "MODIFIED":