From 5ac71f7242cf1ead442255f314d860e9279fd79a Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Thu, 27 Feb 2020 09:57:51 -0500 Subject: [PATCH] explicitly fail publishing if interval or ID are not set --- publish/kafka/publish.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/publish/kafka/publish.go b/publish/kafka/publish.go index fe613220b8..f16597c6c2 100644 --- a/publish/kafka/publish.go +++ b/publish/kafka/publish.go @@ -276,13 +276,12 @@ func (m *mtPublisher) Publish(metrics []*schema.MetricData) error { for _, metric := range metrics { if metric.Interval == 0 { - if m.autoInterval { - _, s := m.schemas.Match(metric.Name, 0) - metric.Interval = s.Retentions.Rets[0].SecondsPerPoint - } else { - log.Error("interval is 0 but can't deduce interval automatically. this should never happen") - return errors.New("need to deduce interval but cannot") - } + log.Error("interval must be set before publishing") + return errors.New("interval must be set before publishing") + } + if metric.Id == "" { + log.Error("metric ID must be set before publishing") + return errors.New("metric ID must be set before publishing") } isMD := false