Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/logcli/util/util.go

20 lines
359 B

package util
import "github.com/grafana/loki/v3/pkg/loghttp"
func MatchLabels(on bool, l loghttp.LabelSet, names []string) loghttp.LabelSet {
ret := loghttp.LabelSet{}
nameSet := map[string]struct{}{}
for _, n := range names {
nameSet[n] = struct{}{}
}
for k, v := range l {
if _, ok := nameSet[k]; on == ok {
ret[k] = v
}
}
return ret
}