Skip to content

Commit 3188d16

Browse files
committed
Address review feedback
1 parent 93048ed commit 3188d16

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/promutil/prometheus.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ var replacer = strings.NewReplacer(
9595
"%", "_percent",
9696
)
9797

98-
// labelPair joins two slices of keys and values
99-
// and allows simultaneous sorting.
98+
// labelPair joins two slices of keys and values and allows
99+
// simultaneous sorting. It implements sort.Interface.
100100
type labelPair struct {
101101
keys []string
102102
vals []string
@@ -175,8 +175,10 @@ var separatorByteSlice = []byte{prom_model.SeparatorByte}
175175

176176
// LabelsSignature returns a hash of the labels. It emulates
177177
// prometheus' LabelsToSignature implementation but works on
178-
// labelPair instead of map[string]string. Assumes that
179-
// the labels are sorted.
178+
// labelPair instead of map[string]string.
179+
// Assumes that the labels are sorted. Notably, this uses
180+
// a different hash function than prometheus, but it doesn't
181+
// matter for the purpose of computing a unique signature.
180182
func (p *PrometheusMetric) LabelsSignature() uint64 {
181183
xxh := xxhash.New()
182184
for i, key := range p.labels.keys {

0 commit comments

Comments
 (0)