Merge pull request #6007 from benbjohnson/explicit-system-names

Allow querying of system-like series
pull/6021/head
Jonathan A. Sternberg 2016-03-15 16:15:17 -04:00
commit eb2d49dbe4
2 changed files with 14 additions and 3 deletions

View File

@ -367,8 +367,19 @@ func (a *Sources) UnmarshalBinary(buf []byte) error {
}
// IsSystemName returns true if name is an internal system name.
// System names are prefixed with an underscore.
func IsSystemName(name string) bool { return strings.HasPrefix(name, "_") }
func IsSystemName(name string) bool {
switch name {
case "_fieldKeys",
"_measurements",
"_series",
"_tagKey",
"_tagKeys",
"_tags":
return true
default:
return false
}
}
// SortField represents a field to sort results by.
type SortField struct {

View File

@ -180,7 +180,7 @@ func (d *DatabaseIndex) measurementsByExpr(expr influxql.Expr) (Measurements, bo
// Match on name, if specified.
if tag.Val == "name" {
return d.measurementsByNameFilter(tf.Op, tf.Value, tf.Regex), true, nil
} else if strings.HasPrefix(tag.Val, "_") {
} else if influxql.IsSystemName(tag.Val) {
return nil, false, nil
}