Skip to content

Commit

Permalink
Merge pull request influxdata#6920 from influxdata/js-6909-log-cq-exe…
Browse files Browse the repository at this point in the history
…cution-time

Log the CQ execution time when continuous query logging is enabled
  • Loading branch information
jsternberg authored Jul 21, 2016
2 parents e3ecbf0 + 4bdf575 commit 92825b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ With this release the systemd configuration files for InfluxDB will use the syst
- [#1110](https://github.com/influxdata/influxdb/issues/1110): Support loading a folder for collectd typesdb files.
- [#6928](https://github.com/influxdata/influxdb/issues/6928): Run continuous query for multiple buckets rather than one per bucket.
- [#5500](https://github.com/influxdata/influxdb/issues/5500): Add extra trace logging to tsm engine.
- [#6909](https://github.com/influxdata/influxdb/issues/6909): Log the CQ execution time when continuous query logging is enabled.

### Bugfixes

Expand Down
6 changes: 6 additions & 0 deletions services/continuous_querier/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,21 @@ func (s *Service) ExecuteContinuousQuery(dbi *meta.DatabaseInfo, cqi *meta.Conti
return err
}

var start time.Time
if s.loggingEnabled {
s.Logger.Printf("executing continuous query %s (%v to %v)", cq.Info.Name, startTime, endTime)
start = time.Now()
}

// Do the actual processing of the query & writing of results.
if err := s.runContinuousQueryAndWriteResult(cq); err != nil {
s.Logger.Printf("error: %s. running: %s\n", err, cq.q.String())
return err
}

if s.loggingEnabled {
s.Logger.Printf("finished continuous query %s (%v to %v) in %s", cq.Info.Name, startTime, endTime, time.Now().Sub(start))
}
return nil
}

Expand Down

0 comments on commit 92825b4

Please sign in to comment.