Skip to content

Commit 9de40f2

Browse files
feat: add segmentation keys and resolver
This commit adds segmentation keys and a resolver that returns the partition for a segmentation key.
1 parent 81deda7 commit 9de40f2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/distributor/segment.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ import (
1818
// distribute load while preserving stream locality for tenants.
1919
type SegmentationKey string
2020

21+
<<<<<<< HEAD
2122
// Sum64 returns a 64 bit, non-cryptographic hash of the key.
23+
=======
24+
// Sum64 returns a 64 bit, non-crytogrpahic hash of the key.
25+
>>>>>>> 5ef092522a (feat: add segmentation keys and resolver)
2226
func (key SegmentationKey) Sum64() uint64 {
2327
h := fnv.New64a()
2428
// Use a reserved word here to avoid any possible hash conflicts with
2529
// streams.
30+
<<<<<<< HEAD
2631
h.Write([]byte("__loki_segmentation_key__"))
32+
=======
33+
h.Write([]byte("__loki__segmentation_key__"))
34+
>>>>>>> 5ef092522a (feat: add segmentation keys and resolver)
2735
h.Write([]byte(key))
2836
return h.Sum64()
2937
}
@@ -44,12 +52,19 @@ func GetSegmentationKey(stream KeyedStream) (SegmentationKey, error) {
4452
type SegmentationPartitionResolver struct {
4553
perPartitionRateBytes uint64
4654
ringReader ring.PartitionRingReader
55+
<<<<<<< HEAD
4756
logger log.Logger
4857

4958
// Metrics.
5059
failed prometheus.Counter
5160
randomlySharded prometheus.Counter
5261
total prometheus.Counter
62+
=======
63+
fallback prometheus.Counter
64+
failed prometheus.Counter
65+
total prometheus.Counter
66+
logger log.Logger
67+
>>>>>>> 5ef092522a (feat: add segmentation keys and resolver)
5368
}
5469

5570
// NewSegmentationPartitionResolver returns a new SegmentationPartitionResolver.

0 commit comments

Comments
 (0)