package graphite import ( "bytes" "fmt" "io" "math" "sort" "strconv" "strings" "time" "bufio" "github.com/influxdata/influxdb/models" "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) ) var defaultTemplate *template func init() { var err error defaultTemplate, err = NewTemplate("measurement*", nil, DefaultSeparator) if err != nil { panic(err) } } // Parser encapsulates a Graphite Parser. type Parser struct { matcher *matcher tags models.Tags } // Options are configurable values that can be provided to a Parser type Options struct { Separator string Templates []string DefaultTags models.Tags } // NewParserWithOptions returns a graphite parser using the given options func NewParserWithOptions(options Options) (*Parser, error) { matcher := newMatcher() matcher.AddDefaultTemplate(defaultTemplate) for _, pattern := range options.Templates { template := pattern filter := "" // Format is [filter]