package graphite import ( "fmt" "math" "sort" "strconv" "strings" "time" "github.com/influxdata/influxdb/models" ) // Minimum and maximum supported dates for timestamps. var ( // The minimum graphite timestamp allowed. MinDate = time.Date(1901, 12, 13, 0, 0, 0, 0, time.UTC) // The maximum graphite timestamp allowed. 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]