From 426bd3fb854e8ae690bd58f657d73ca35a0d18ea Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 26 Jan 2020 14:54:31 +0100 Subject: [PATCH] Handle metrics errors, prevent blocking err chan Signed-off-by: Knut Ahlers --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 8388d4d..ca16e0f 100644 --- a/main.go +++ b/main.go @@ -63,6 +63,12 @@ func main() { log.WithError(err).Fatal("Unable to create metrics client") } + go func() { + for err := range metrics.Errors() { + log.WithError(err).Error("Metrics processing caused an error") + } + }() + var input io.Reader = os.Stdin if len(rconfig.Args()) > 1 { f, err := os.Open(rconfig.Args()[1])