Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch error handling #309

Merged
merged 1 commit into from
Mar 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ With #144 you can now join streams with differing group by dimensions.
- [#270](https://github.com/influxdata/kapacitor/issues/270): The HTTP server will now gracefully stop.
- [#300](https://github.com/influxdata/kapacitor/issues/300): Add OPTIONS method to /recording endpoint for deletes.
- [#304](https://github.com/influxdata/kapacitor/issues/304): Fix panic if recording query but do not have an InfluxDB instance configured
- [#289](https://github.com/influxdata/kapacitor/issues/289): Add better error handling to batch node.

## v0.10.1 [2016-02-08]

Expand Down
17 changes: 12 additions & 5 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ func (b *BatchNode) doQuery() error {
// Connect
con, err := b.et.tm.InfluxDBService.NewClient()
if err != nil {
return err
b.logger.Println("E! failed to connect to InfluxDB:", err)
break
}
q := client.Query{
Command: b.query.String(),
Expand All @@ -271,22 +272,28 @@ func (b *BatchNode) doQuery() error {
// Execute query
resp, err := con.Query(q)
if err != nil {
return err
b.logger.Println("E! query failed:", err)
break
}

if err := resp.Error(); err != nil {
return err
b.logger.Println("E! query failed:", err)
break
}

// Collect batches
for _, res := range resp.Results {
batches, err := models.ResultToBatches(res)
if err != nil {
return err
b.logger.Println("E! failed to understand query result:", err)
continue
}
b.timer.Pause()
for _, bch := range batches {
b.ins[0].CollectBatch(bch)
err := b.ins[0].CollectBatch(bch)
if err != nil {
return err
}
}
b.timer.Resume()
}
Expand Down