package graphite import ( "bufio" "bytes" "fmt" "io" "math" "sort" "strconv" "strings" "time" "github.com/influxdata/telegraf" ) // Minimum and maximum supported dates for timestamps. var ( MinDate = time.Date(1901, 12, 13, 0, 0, 0, 0, time.UTC) MaxDate = time.Date(2038, 1, 19, 0, 0, 0, 0, time.UTC) ) // Parser encapsulates a Graphite Parser. type GraphiteParser struct { Separator string Templates []string DefaultTags map[string]string matcher *matcher } func NewGraphiteParser( separator string, templates []string, defaultTags map[string]string, ) (*GraphiteParser, error) { var err error if separator == "" { separator = DefaultSeparator } p := &GraphiteParser{ Separator: separator, Templates: templates, } if defaultTags != nil { p.DefaultTags = defaultTags } matcher := newMatcher() p.matcher = matcher defaultTemplate, _ := NewTemplate("measurement*", nil, p.Separator) matcher.AddDefaultTemplate(defaultTemplate) for _, pattern := range p.Templates { template := pattern filter := "" // Format is [filter]