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 18af31a4c2
commit 5701b2f7bb

View file

@ -283,10 +283,14 @@ func labelValuesWithMatches(labelName string, matches []string, start, end int64
if err != nil {
return nil, 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,
})
}