mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Fix off-by-one bug in NewFingerprintFromMetric().
This commit is contained in:
parent
ca2a31c48b
commit
0230dbf305
|
@ -94,7 +94,7 @@ func NewFingerprintFromMetric(metric Metric) (f Fingerprint) {
|
|||
firstCharacterOfFirstLabelName = labelName[0:1]
|
||||
}
|
||||
if i == labelLength-1 {
|
||||
lastCharacterOfLastLabelValue = string(labelValue[labelValueLength-2 : labelValueLength-1])
|
||||
lastCharacterOfLastLabelValue = string(labelValue[labelValueLength-1 : labelValueLength])
|
||||
}
|
||||
|
||||
summer.Write([]byte(labelName))
|
||||
|
|
|
@ -35,9 +35,16 @@ func testMetric(t test.Tester) {
|
|||
"occupation": "robot",
|
||||
"manufacturer": "westinghouse",
|
||||
},
|
||||
rowkey: "04776841610193542734-f-56-o",
|
||||
rowkey: "04776841610193542734-f-56-t",
|
||||
hash: 4776841610193542734,
|
||||
},
|
||||
{
|
||||
input: map[string]string{
|
||||
"x": "y",
|
||||
},
|
||||
rowkey: "01306929544689993150-x-2-y",
|
||||
hash: 1306929544689993150,
|
||||
},
|
||||
}
|
||||
|
||||
for i, scenario := range scenarios {
|
||||
|
|
Loading…
Reference in a new issue