From 75f5ac8980e653ba9e3c62d168a1ba7516b480e9 Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Fri, 26 Nov 2021 19:01:31 +0100 Subject: [PATCH] Catch panicing collectors (hello Nvidia Go Bindings) late. --- collectors/metricCollector.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/collectors/metricCollector.go b/collectors/metricCollector.go index b403de8..0228530 100644 --- a/collectors/metricCollector.go +++ b/collectors/metricCollector.go @@ -13,6 +13,7 @@ import ( type MetricGetter interface { Name() string Init(config []byte) error + Initialized() bool Read(time.Duration, *[]lp.MutableMetric) Close() } @@ -30,6 +31,10 @@ func (c *MetricCollector) setup() error { return nil } +func (c *MetricCollector) Initialized() bool { + return c.init == true +} + func intArrayContains(array []int, str int) (int, bool) { for i, a := range array { if a == str {