mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #132 from prometheus/julius-leveldb-sorting
Make LevelDB sample keys fixed-length to ensure correct sort-order.
This commit is contained in:
commit
2d70e75c52
|
@ -38,11 +38,14 @@ message LabelSet {
|
||||||
repeated LabelPair member = 1;
|
repeated LabelPair member = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The default LevelDB comparator sorts not only lexicographically, but also by
|
||||||
|
// key length (which takes precedence). Thus, no variable-length fields may be
|
||||||
|
// introduced into the key definition below.
|
||||||
message SampleKey {
|
message SampleKey {
|
||||||
optional Fingerprint fingerprint = 1;
|
optional Fingerprint fingerprint = 1;
|
||||||
optional bytes timestamp = 2;
|
optional bytes timestamp = 2;
|
||||||
optional int64 last_timestamp = 3;
|
optional sfixed64 last_timestamp = 3;
|
||||||
optional uint32 sample_count = 4;
|
optional fixed32 sample_count = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SampleValueSeries {
|
message SampleValueSeries {
|
||||||
|
|
|
@ -106,7 +106,7 @@ func NewFingerprintFromMetric(metric Metric) (f Fingerprint) {
|
||||||
return fingerprint{
|
return fingerprint{
|
||||||
firstCharacterOfFirstLabelName: firstCharacterOfFirstLabelName,
|
firstCharacterOfFirstLabelName: firstCharacterOfFirstLabelName,
|
||||||
hash: binary.LittleEndian.Uint64(summer.Sum(nil)),
|
hash: binary.LittleEndian.Uint64(summer.Sum(nil)),
|
||||||
labelMatterLength: uint(labelMatterLength),
|
labelMatterLength: uint(labelMatterLength % 10),
|
||||||
lastCharacterOfLastLabelValue: lastCharacterOfLastLabelValue,
|
lastCharacterOfLastLabelValue: lastCharacterOfLastLabelValue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ func testMetric(t test.Tester) {
|
||||||
"occupation": "robot",
|
"occupation": "robot",
|
||||||
"manufacturer": "westinghouse",
|
"manufacturer": "westinghouse",
|
||||||
},
|
},
|
||||||
rowkey: "04776841610193542734-f-56-t",
|
rowkey: "04776841610193542734-f-6-t",
|
||||||
hash: 4776841610193542734,
|
hash: 4776841610193542734,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue