Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clients/pkg/promtail/wal/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func (wrt *Writer) SubscribeWrite(subscriber WriteEventSubscriber) {
// across every write.
type entryWriter struct {
reusableWALRecord *wal.Record
lbsBuf []byte // buffer for hashing labels
}

// newEntryWriter creates a new entryWriter.
Expand All @@ -247,7 +248,7 @@ func (ew *entryWriter) WriteEntry(entry api.Entry, wl WAL, _ log.Logger) error {

var fp uint64
lbs := labels.FromMap(util.ModelLabelSetToMap(entry.Labels))
fp, _ = lbs.HashWithoutLabels(nil, []string(nil)...)
fp, ew.lbsBuf = lbs.HashWithoutLabels(ew.lbsBuf)

// Append the entry to an already existing stream (if any)
ew.reusableWALRecord.RefEntries = append(ew.reusableWALRecord.RefEntries, wal.RefEntries{
Expand Down
2 changes: 1 addition & 1 deletion pkg/blockbuilder/builder/appender.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (m *streamsMap) getLabelsFromFingerprint(fp model.Fingerprint) labels.Label

func (i *instance) getHashForLabels(ls labels.Labels) model.Fingerprint {
var fp uint64
fp, i.buf = ls.HashWithoutLabels(i.buf, []string(nil)...)
fp, i.buf = ls.HashWithoutLabels(i.buf)
return i.mapper.MapFP(model.Fingerprint(fp), ls)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/dataobj/querier/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (sp *streamProcessor) processSingleReader(ctx context.Context, reader *stre
break
}
for _, stream := range streams[:n] {
h, buf = stream.Labels.HashWithoutLabels(buf, []string(nil)...)
h, buf = stream.Labels.HashWithoutLabels(buf)
// Try to claim this hash first
if _, seen := sp.seenSeries.LoadOrStore(h, nil); seen {
continue
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingester/index/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func BenchmarkHash(b *testing.B) {
b.Run("xxash", func(b *testing.B) {
for n := 0; n < b.N; n++ {
var fp uint64
fp, buf = logproto.FromLabelAdaptersToLabels(lbs).HashWithoutLabels(buf, []string(nil)...)
fp, buf = logproto.FromLabelAdaptersToLabels(lbs).HashWithoutLabels(buf)
result = util.HashFP(model.Fingerprint(fp)) % 16
}
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingester/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func (i *instance) removeStream(s *stream) {

func (i *instance) getHashForLabels(ls labels.Labels) model.Fingerprint {
var fp uint64
fp, i.buf = ls.HashWithoutLabels(i.buf, []string(nil)...)
fp, i.buf = ls.HashWithoutLabels(i.buf)
return i.mapper.MapFP(model.Fingerprint(fp), ls)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/logql/log/labels_slicelabels.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ func newHasher() *hasher {
// It is not guaranteed to be stable across different Loki processes or versions.
func (h *hasher) Hash(lbs labels.Labels) uint64 {
var hash uint64
hash, h.buf = lbs.HashWithoutLabels(h.buf, []string(nil)...)
hash, h.buf = lbs.HashWithoutLabels(h.buf)
return hash
}
2 changes: 1 addition & 1 deletion pkg/pattern/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (i *instance) createStream(_ context.Context, pushReqStream logproto.Stream

func (i *instance) getHashForLabels(ls labels.Labels) model.Fingerprint {
var fp uint64
fp, i.buf = ls.HashWithoutLabels(i.buf, []string(nil)...)
fp, i.buf = ls.HashWithoutLabels(i.buf)
return i.mapper.MapFP(model.Fingerprint(fp), ls)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/queryrange/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func (sl *seriesLimiter) Do(ctx context.Context, req queryrangebase.Request) (qu
}
}

hash, sl.buf = lbs.HashWithoutLabels(sl.buf, []string(nil)...)
hash, sl.buf = lbs.HashWithoutLabels(sl.buf)

// If there's a variant label, track it in the variant map
if variant != "" {
Expand Down
Loading