Skip to content

Commit

Permalink
Do not write metrics if there are 0 to write
Browse files Browse the repository at this point in the history
closes #884
  • Loading branch information
sparrc committed Mar 18, 2016
1 parent 061b749 commit 77dcbe9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Bugfixes
[#890](https://github.com/influxdata/telegraf/issues/890): Create TLS config even if only ssl_ca is provided.
[#884](https://github.com/influxdata/telegraf/issues/884): Do not call write method if there are 0 metrics to write.

## v0.11.1 [2016-03-17]

Expand Down
3 changes: 3 additions & 0 deletions internal/models/running_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func (ro *RunningOutput) Write() error {
}

func (ro *RunningOutput) write(metrics []telegraf.Metric) error {
if len(metrics) == 0 {
return nil
}
start := time.Now()
err := ro.Output.Write(metrics)
elapsed := time.Since(start)
Expand Down

0 comments on commit 77dcbe9

Please sign in to comment.