Add influx uint support as a runtime option (#3948)

This commit is contained in:
Daniel Nelson
2018-03-29 13:31:43 -07:00
committed by GitHub
parent c2108fcf09
commit b99cd14129
12 changed files with 168 additions and 84 deletions

View File

@@ -40,6 +40,9 @@ type Config struct {
// than unsorted fields; influx format only
InfluxSortFields bool
// Support unsigned integer output; influx format only
InfluxUintSupport bool
// Prefix to add to all measurements, only supports Graphite
Prefix string
@@ -77,9 +80,16 @@ func NewInfluxSerializerConfig(config *Config) (Serializer, error) {
if config.InfluxSortFields {
sort = influx.SortFields
}
var typeSupport influx.FieldTypeSupport
if config.InfluxUintSupport {
typeSupport = typeSupport + influx.UintSupport
}
s := influx.NewSerializer()
s.SetMaxLineBytes(config.InfluxMaxLineBytes)
s.SetFieldSortOrder(sort)
s.SetFieldTypeSupport(typeSupport)
return s, nil
}