Skip to content

Commit

Permalink
Merge pull request influxdata#365 from influxdata/nc-fixes
Browse files Browse the repository at this point in the history
Fix alert log and batches with no values
  • Loading branch information
Nathaniel Cook committed Mar 21, 2016
2 parents d8d1b06 + 8bd33df commit 7fdc137
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func (a *AlertNode) runAlert([]byte) error {
}
func (a *AlertNode) handleAlert(ad *AlertData) {
a.statMap.Add(statsAlertsTriggered, 1)
a.logger.Printf("D! %v alert triggered id:%s msg:%s data:%v", ad.Level, ad.ID, ad.Message, ad.Data)
a.logger.Printf("D! %v alert triggered id:%s msg:%s data:%v", ad.Level, ad.ID, ad.Message, ad.Data.Series[0])
for _, h := range a.handlers {
h(ad)
}
Expand Down
9 changes: 6 additions & 3 deletions models/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ func ResultToBatches(res client.Result) ([]Batch, error) {
if res.Err != "" {
return nil, errors.New(res.Err)
}
batches := make([]Batch, len(res.Series))
for i, series := range res.Series {
batches := make([]Batch, 0, len(res.Series))
for _, series := range res.Series {
if len(series.Values) == 0 {
continue
}
groupID := TagsToGroupID(
SortedKeys(series.Tags),
series.Tags,
Expand Down Expand Up @@ -183,7 +186,7 @@ func ResultToBatches(res client.Result) ([]Batch, error) {
)
}
}
batches[i] = b
batches = append(batches, b)
}
return batches, nil
}

0 comments on commit 7fdc137

Please sign in to comment.