app/vmselect/netstorage: apply Graphite filter after substituting __name__ with name

This commit is contained in:
Aliaksandr Valialkin 2020-11-16 15:50:48 +02:00
parent 72ab3f7230
commit cf18df367d

View file

@ -483,12 +483,6 @@ func GetGraphiteTags(filter string, limit int, deadline searchutils.Deadline) ([
if err != nil {
return nil, err
}
if len(filter) > 0 {
labels, err = applyGraphiteRegexpFilter(filter, labels)
if err != nil {
return nil, err
}
}
// Substitute "__name__" with "name" for Graphite compatibility
for i := range labels {
if labels[i] == "__name__" {
@ -497,6 +491,12 @@ func GetGraphiteTags(filter string, limit int, deadline searchutils.Deadline) ([
break
}
}
if len(filter) > 0 {
labels, err = applyGraphiteRegexpFilter(filter, labels)
if err != nil {
return nil, err
}
}
if limit > 0 && limit < len(labels) {
labels = labels[:limit]
}