make timestamp_selector exposed in config

This commit is contained in:
Kirk Young 2016-08-01 17:41:21 -07:00
parent 6f7b819c36
commit 112598944e
1 changed files with 18 additions and 0 deletions

View File

@ -916,6 +916,22 @@ func buildParser(name string, tbl *ast.Table) (parsers.Parser, error) {
} }
} }
if node, ok := tbl.Fields["timestamp_selector"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if str, ok := kv.Value.(*ast.String); ok {
c.TimestampSelector = str.Value
}
}
}
if node, ok := tbl.Fields["timestamp_formatter"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if str, ok := kv.Value.(*ast.String); ok {
c.TimestampFormatter = str.Value
}
}
}
c.MetricName = name c.MetricName = name
delete(tbl.Fields, "data_format") delete(tbl.Fields, "data_format")
@ -923,6 +939,8 @@ func buildParser(name string, tbl *ast.Table) (parsers.Parser, error) {
delete(tbl.Fields, "templates") delete(tbl.Fields, "templates")
delete(tbl.Fields, "tag_keys") delete(tbl.Fields, "tag_keys")
delete(tbl.Fields, "data_type") delete(tbl.Fields, "data_type")
delete(tbl.Fields, "timestamp_selector")
delete(tbl.Fields, "timestamp_formatter")
return parsers.NewParser(c) return parsers.NewParser(c)
} }