Skip to content

Commit

Permalink
Only log warning on type when in debug mode.
Browse files Browse the repository at this point in the history
closes #1793
  • Loading branch information
EricFortin authored and sparrc committed Oct 11, 2016
1 parent 1f7a8fc commit 3e3b094
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ continue sending logs to /var/log/telegraf/telegraf.log.
- [#1835](https://github.com/influxdata/telegraf/issues/1835): Fix SNMP emitting empty fields.
- [#1854](https://github.com/influxdata/telegraf/pull/1853): SQL Server waitstats truncation bug.
- [#1810](https://github.com/influxdata/telegraf/issues/1810): Fix logparser common log format: numbers in ident.
- [#1793](https://github.com/influxdata/telegraf/pull/1793): Fix JSON Serialization in OpenTSDB output.

## v1.0.1 [2016-09-26]

Expand Down
8 changes: 3 additions & 5 deletions plugins/outputs/opentsdb/opentsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package opentsdb

import (
"fmt"
"log"
"net"
"net/url"
"sort"
Expand Down Expand Up @@ -114,7 +115,7 @@ func (o *OpenTSDB) WriteHttp(metrics []telegraf.Metric, u *url.URL) error {
case uint64:
case float64:
default:
fmt.Printf("OpenTSDB does not support metric value: [%s] of type [%T].\n", value, value)
log.Printf("D! OpenTSDB does not support metric value: [%s] of type [%T].\n", value, value)
continue
}

Expand Down Expand Up @@ -156,17 +157,14 @@ func (o *OpenTSDB) WriteTelnet(metrics []telegraf.Metric, u *url.URL) error {
for fieldName, value := range m.Fields() {
metricValue, buildError := buildValue(value)
if buildError != nil {
fmt.Printf("OpenTSDB: %s\n", buildError.Error())
log.Printf("E! OpenTSDB: %s\n", buildError.Error())
continue
}

messageLine := fmt.Sprintf("put %s %v %s %s\n",
sanitizedChars.Replace(fmt.Sprintf("%s%s_%s", o.Prefix, m.Name(), fieldName)),
now, metricValue, tags)

if o.Debug {
fmt.Print(messageLine)
}
_, err := connection.Write([]byte(messageLine))
if err != nil {
return fmt.Errorf("OpenTSDB: Telnet writing error %s", err.Error())
Expand Down

0 comments on commit 3e3b094

Please sign in to comment.