Skip to content

Commit

Permalink
Merge pull request #1426 from influxdata/metrics-panic
Browse files Browse the repository at this point in the history
nil metric list panic fix
  • Loading branch information
Kostas Botsas authored Jun 29, 2016
2 parents 048448a + 2d4864e commit c046232
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ should now look like:

### Bugfixes

- [#1426](https://github.com/influxdata/telegraf/pull/1426): nil metrics panic fix.
- [#1384](https://github.com/influxdata/telegraf/pull/1384): Fix datarace in apache input plugin.
- [#1399](https://github.com/influxdata/telegraf/issues/1399): Add `read_repairs` statistics to riak plugin.
- [#1405](https://github.com/influxdata/telegraf/issues/1405): Fix memory/connection leak in prometheus input plugin.
Expand Down
2 changes: 1 addition & 1 deletion internal/models/running_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (ro *RunningOutput) Write() error {
}

func (ro *RunningOutput) write(metrics []telegraf.Metric) error {
if len(metrics) == 0 {
if metrics == nil || len(metrics) == 0 {
return nil
}
start := time.Now()
Expand Down
7 changes: 7 additions & 0 deletions plugins/serializers/graphite/graphite.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]string, error)
timestamp := metric.UnixNano() / 1000000000

bucket := s.SerializeBucketName(metric.Name(), metric.Tags())
if bucket == "" {
return out, nil
}

for fieldName, value := range metric.Fields() {
// Convert value to string
Expand Down Expand Up @@ -89,6 +92,10 @@ func (s *GraphiteSerializer) SerializeBucketName(
}
}

if len(out) == 0 {
return ""
}

if s.Prefix == "" {
return sanitizedChars.Replace(strings.Join(out, "."))
}
Expand Down

0 comments on commit c046232

Please sign in to comment.