feat(mqe): add support for wildcard series

This commit is contained in:
bergquist 2016-11-16 10:03:22 +01:00
parent fa92dfb7b2
commit 430104aaac

View File

@ -7,6 +7,7 @@ import (
"regexp" "regexp"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/tsdb" "github.com/grafana/grafana/pkg/tsdb"
) )
@ -31,7 +32,6 @@ var (
containsWildcardPattern *regexp.Regexp = regexp.MustCompile(`\*`) containsWildcardPattern *regexp.Regexp = regexp.MustCompile(`\*`)
) )
//`os.disk.sda.io_time` where host in ('staples-lab-1') from 1479197578194 to 1479219178194
func (q *MQEQuery) Build(availableSeries []string) ([]string, error) { func (q *MQEQuery) Build(availableSeries []string) ([]string, error) {
var queries []string var queries []string
where := q.buildWhereClause() where := q.buildWhereClause()
@ -44,13 +44,20 @@ func (q *MQEQuery) Build(availableSeries []string) ([]string, error) {
continue continue
} }
/* m := strings.Replace(v.Metric, "*", ".*", -1)
for _, a := range availableSeries { mp, err := regexp.Compile(m)
if match {
metrics = append(metrics, a) if err != nil {
} log.Error2("failed to compile regex for ", "metric", m)
continue
}
//TODO: this lookup should be cached
for _, a := range availableSeries {
if mp.Match([]byte(a)) {
metrics = append(metrics, a)
} }
*/ }
} }
for _, metric := range metrics { for _, metric := range metrics {