Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
explicitly fail publishing if interval or ID are not set
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzoh committed Feb 27, 2020
1 parent 9cc9266 commit 5ac71f7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions publish/kafka/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ac71f7

Please sign in to comment.