Add wavefront serializer plugin (#5670)
This commit is contained in:
committed by
Daniel Nelson
parent
991e83c35f
commit
267a9f182b
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/influxdata/telegraf/plugins/serializers/json"
|
||||
"github.com/influxdata/telegraf/plugins/serializers/nowmetric"
|
||||
"github.com/influxdata/telegraf/plugins/serializers/splunkmetric"
|
||||
"github.com/influxdata/telegraf/plugins/serializers/wavefront"
|
||||
)
|
||||
|
||||
// SerializerOutput is an interface for output plugins that are able to
|
||||
@@ -66,6 +67,13 @@ type Config struct {
|
||||
|
||||
// Include HEC routing fields for splunkmetric output
|
||||
HecRouting bool
|
||||
|
||||
// Point tags to use as the source name for Wavefront (if none found, host will be used).
|
||||
WavefrontSourceOverride []string
|
||||
|
||||
// Use Strict rules to sanitize metric and tag names from invalid characters for Wavefront
|
||||
// When enabled forward slash (/) and comma (,) will be accepted
|
||||
WavefrontUseStrict bool
|
||||
}
|
||||
|
||||
// NewSerializer a Serializer interface based on the given config.
|
||||
@@ -85,12 +93,18 @@ func NewSerializer(config *Config) (Serializer, error) {
|
||||
serializer, err = NewNowSerializer()
|
||||
case "carbon2":
|
||||
serializer, err = NewCarbon2Serializer()
|
||||
case "wavefront":
|
||||
serializer, err = NewWavefrontSerializer(config.Prefix, config.WavefrontUseStrict, config.WavefrontSourceOverride)
|
||||
default:
|
||||
err = fmt.Errorf("Invalid data format: %s", config.DataFormat)
|
||||
}
|
||||
return serializer, err
|
||||
}
|
||||
|
||||
func NewWavefrontSerializer(prefix string, useStrict bool, sourceOverride []string) (Serializer, error) {
|
||||
return wavefront.NewSerializer(prefix, useStrict, sourceOverride)
|
||||
}
|
||||
|
||||
func NewJsonSerializer(timestampUnits time.Duration) (Serializer, error) {
|
||||
return json.NewSerializer(timestampUnits)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user