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 6bcbdb18fb
commit 59fb75717e

View File

@ -567,12 +567,6 @@ func GetGraphiteTags(at *auth.Token, denyPartialResponse bool, filter string, li
if err != nil { if err != nil {
return nil, false, err return nil, false, err
} }
if len(filter) > 0 {
labels, err = applyGraphiteRegexpFilter(filter, labels)
if err != nil {
return nil, false, err
}
}
// Substitute "__name__" with "name" for Graphite compatibility // Substitute "__name__" with "name" for Graphite compatibility
for i := range labels { for i := range labels {
if labels[i] == "__name__" { if labels[i] == "__name__" {
@ -581,6 +575,12 @@ func GetGraphiteTags(at *auth.Token, denyPartialResponse bool, filter string, li
break break
} }
} }
if len(filter) > 0 {
labels, err = applyGraphiteRegexpFilter(filter, labels)
if err != nil {
return nil, false, err
}
}
if limit > 0 && limit < len(labels) { if limit > 0 && limit < len(labels) {
labels = labels[:limit] labels = labels[:limit]
} }