Merge pull request #1426 from influxdata/metrics-panic
nil metric list panic fix
This commit is contained in:
commit
c046232425
|
@ -36,6 +36,7 @@ should now look like:
|
||||||
|
|
||||||
### Bugfixes
|
### 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.
|
- [#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.
|
- [#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.
|
- [#1405](https://github.com/influxdata/telegraf/issues/1405): Fix memory/connection leak in prometheus input plugin.
|
||||||
|
|
|
@ -138,7 +138,7 @@ func (ro *RunningOutput) Write() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ro *RunningOutput) write(metrics []telegraf.Metric) error {
|
func (ro *RunningOutput) write(metrics []telegraf.Metric) error {
|
||||||
if len(metrics) == 0 {
|
if metrics == nil || len(metrics) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
|
@ -26,6 +26,9 @@ func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]string, error)
|
||||||
timestamp := metric.UnixNano() / 1000000000
|
timestamp := metric.UnixNano() / 1000000000
|
||||||
|
|
||||||
bucket := s.SerializeBucketName(metric.Name(), metric.Tags())
|
bucket := s.SerializeBucketName(metric.Name(), metric.Tags())
|
||||||
|
if bucket == "" {
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
for fieldName, value := range metric.Fields() {
|
for fieldName, value := range metric.Fields() {
|
||||||
// Convert value to string
|
// Convert value to string
|
||||||
|
@ -89,6 +92,10 @@ func (s *GraphiteSerializer) SerializeBucketName(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(out) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if s.Prefix == "" {
|
if s.Prefix == "" {
|
||||||
return sanitizedChars.Replace(strings.Join(out, "."))
|
return sanitizedChars.Replace(strings.Join(out, "."))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue