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/logql/log/labels_stringlabels.go

21 lines
702 B

//go:build !slicelabels && !dedupelabels
package log
import "github.com/prometheus/prometheus/model/labels"
type hasher struct{}
// newHasher returns a hasher that computes hashes for labels.
func newHasher() *hasher {
return &hasher{}
}
// Hash computes a hash of lbs.
// It is not guaranteed to be stable across different Loki processes or versions.
func (h *hasher) Hash(lbs labels.Labels) uint64 {
// We use Hash() here because there's no performance advantage to using HashWithoutLabels() with stringlabels.
// The results from Hash(l) and HashWithoutLabels(l, []string{}) are different with stringlabels, so using Hash
// here also simplifies our tests.
return labels.StableHash(lbs)
}