diff --git a/model/data.proto b/model/data.proto index 3b6004e3d..95e25e2d9 100644 --- a/model/data.proto +++ b/model/data.proto @@ -38,11 +38,14 @@ message LabelSet { 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 { optional Fingerprint fingerprint = 1; optional bytes timestamp = 2; - optional int64 last_timestamp = 3; - optional uint32 sample_count = 4; + optional sfixed64 last_timestamp = 3; + optional fixed32 sample_count = 4; } message SampleValueSeries { @@ -89,4 +92,4 @@ message CurationValue { // which the curator last completed its duty cycle for a given metric // fingerprint. optional int64 last_completion_timestamp = 1; -} \ No newline at end of file +} diff --git a/model/fingerprinting.go b/model/fingerprinting.go index ac3b1deb4..c18e5b875 100644 --- a/model/fingerprinting.go +++ b/model/fingerprinting.go @@ -106,7 +106,7 @@ func NewFingerprintFromMetric(metric Metric) (f Fingerprint) { return fingerprint{ firstCharacterOfFirstLabelName: firstCharacterOfFirstLabelName, hash: binary.LittleEndian.Uint64(summer.Sum(nil)), - labelMatterLength: uint(labelMatterLength), + labelMatterLength: uint(labelMatterLength % 10), lastCharacterOfLastLabelValue: lastCharacterOfLastLabelValue, } } diff --git a/model/metric_test.go b/model/metric_test.go index 44d2f0f47..4aff61170 100644 --- a/model/metric_test.go +++ b/model/metric_test.go @@ -35,7 +35,7 @@ func testMetric(t test.Tester) { "occupation": "robot", "manufacturer": "westinghouse", }, - rowkey: "04776841610193542734-f-56-t", + rowkey: "04776841610193542734-f-6-t", hash: 4776841610193542734, }, {