app/vmselect/prometheus: properly pass filter for labelName=__name__ in labelValuesWithMatches

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/343
This commit is contained in:
Aliaksandr Valialkin 2020-02-28 12:17:27 +02:00
parent cf9aee4ec3
commit 8fa1cd24d8

View File

@ -340,10 +340,14 @@ func labelValuesWithMatches(at *auth.Token, labelName string, matches []string,
if err != nil {
return nil, false, err
}
// Add `labelName!=''` tag filter in order to filter out series without the labelName.
key := []byte(labelName)
if string(key) == "__name__" {
key = nil
}
for i, tfs := range tagFilterss {
// Add `labelName!=''` tag filter in order to filter out series without the labelName.
tagFilterss[i] = append(tfs, storage.TagFilter{
Key: []byte(labelName),
Key: key,
IsNegative: true,
})
}