Add configurable separator graphite serializer and output (#7545)

This commit is contained in:
ihard
2020-05-21 03:15:18 +03:00
committed by GitHub
parent 10560e5a10
commit 94c75b51a8
10 changed files with 327 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ import (
type Graphite struct {
GraphiteTagSupport bool
GraphiteSeparator string
// URL is only for backwards compatibility
Servers []string
Prefix string
@@ -41,6 +42,9 @@ var sampleConfig = `
## Enable Graphite tags support
# graphite_tag_support = false
## Character for separating metric name and field for Graphite tags
# graphite_separator = "."
## Graphite templates patterns
## 1. Template for cpu
## 2. Template for disk*
@@ -145,7 +149,7 @@ func checkEOF(conn net.Conn) {
func (g *Graphite) Write(metrics []telegraf.Metric) error {
// Prepare data
var batch []byte
s, err := serializers.NewGraphiteSerializer(g.Prefix, g.Template, g.GraphiteTagSupport, g.Templates)
s, err := serializers.NewGraphiteSerializer(g.Prefix, g.Template, g.GraphiteTagSupport, g.GraphiteSeparator, g.Templates)
if err != nil {
return err
}