Skip to content

Commit

Permalink
add influx_uint_support support to outputs.influxdb
Browse files Browse the repository at this point in the history
  • Loading branch information
ragzilla committed Mar 29, 2018
1 parent 8712f2c commit 36d48fd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/outputs/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type InfluxDB struct {
HTTPHeaders map[string]string `toml:"http_headers"`
ContentEncoding string `toml:"content_encoding"`
SkipDatabaseCreation bool `toml:"skip_database_creation"`
InfluxUintSupport bool `toml:"influx_uint_support"`

// Path to CA file
SSLCA string `toml:"ssl_ca"`
Expand Down Expand Up @@ -119,6 +120,12 @@ var sampleConfig = `
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "identity"
## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: "42u". You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false
`

func (i *InfluxDB) Connect() error {
Expand All @@ -134,7 +141,13 @@ func (i *InfluxDB) Connect() error {
urls = append(urls, defaultURL)
}

var typeSupport influx.FieldTypeSupport
if i.InfluxUintSupport {
typeSupport = typeSupport + influx.UintSupport
}

i.serializer = influx.NewSerializer()
i.serializer.SetFieldTypeSupport(typeSupport)

for _, u := range urls {
u, err := url.Parse(u)
Expand Down

0 comments on commit 36d48fd

Please sign in to comment.