tsdb: use abstractions over Labels

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2022-10-27 18:34:26 +01:00
parent 9bb9faabb1
commit 2e22653db4
2 changed files with 7 additions and 3 deletions

View file

@ -1176,13 +1176,17 @@ func (c *LeveledCompactor) populateSymbols(sets []storage.ChunkSeriesSet, outBlo
obIx = labels.StableHash(s.Labels()) % uint64(len(outBlocks))
}
for _, l := range s.Labels() {
err := s.Labels().Validate(func(l labels.Label) error {
if err := batchers[obIx].addSymbol(l.Name); err != nil {
return errors.Wrap(err, "addSymbol to batcher")
}
if err := batchers[obIx].addSymbol(l.Value); err != nil {
return errors.Wrap(err, "addSymbol to batcher")
}
return nil
})
if err != nil {
return err
}
}

View file

@ -596,10 +596,10 @@ func TestCompaction_CompactWithSplitting(t *testing.T) {
require.Equal(t, uint64(shardIndex), lbls.Labels().Hash()%shardCount)
// Collect all symbols used by series.
for _, l := range lbls.Labels() {
lbls.Labels().Range(func(l labels.Label) {
seriesSymbols[l.Name] = struct{}{}
seriesSymbols[l.Value] = struct{}{}
}
})
}
require.NoError(t, p.Err())