package graphite import ( "bytes" "fmt" "io" "math" "sort" "strconv" "strings" "time" "bufio" "github.com/influxdata/influxdb/models" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal/encoding" ) // 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) ) // Options are configurable values that can be provided to a Parser type Options struct { Separator string Templates []string } // Parser encapsulates a Graphite Parser. type GraphiteParser struct { matcher *matcher } func NewParser() *GraphiteParser { return &GraphiteParser{} } func (p *GraphiteParser) InitConfig(configs map[string]interface{}) error { var err error options := Options{ Templates: configs["Templates"].([]string), Separator: configs["Separator"].(string)} matcher := newMatcher() p.matcher = matcher defaultTemplate, _ := NewTemplate("measurement*", nil, DefaultSeparator) matcher.AddDefaultTemplate(defaultTemplate) for _, pattern := range options.Templates { template := pattern filter := "" // Format is [filter]