From a7ff7138f27137b11ceaa93990578e0c0bb6e395 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 14 Jul 2022 19:40:31 +0200 Subject: [PATCH] Flatten the buckets of native histograms This is slightly more efficient on the wire, and it matches the way the corresponding Go types are structured (`histogram.Histogram` and `histogram.FloatHistogram`). This follow the change for the remote-write protobuf in https://github.com/prometheus/prometheus/pull/11011 . This commit also moves away from the "sparse histogram" naming in lieu of the preferred name "native histogram". Note that this is deliberately an incompatible change of the proto spec. Keeping compatibility would cause some hassle but not much gain because we haven't published the proto spec in any release yet and always marked it as experimental. Compatibility to the released proto spec (without native histograms) is kept, of course. Signed-off-by: beorn7 --- go/metrics.pb.go | 324 ++++++++++++++--------------- io/prometheus/client/metrics.proto | 62 +++--- 2 files changed, 193 insertions(+), 193 deletions(-) diff --git a/go/metrics.pb.go b/go/metrics.pb.go index 8fca0a8..35904ea 100644 --- a/go/metrics.pb.go +++ b/go/metrics.pb.go @@ -354,25 +354,37 @@ func (m *Untyped) GetValue() float64 { } type Histogram struct { - SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"` - SampleCountFloat *float64 `protobuf:"fixed64,9,opt,name=sample_count_float,json=sampleCountFloat" json:"sample_count_float,omitempty"` - SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"` - Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"` - // Sparse bucket (sb) stuff: - // The sb_schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8. + SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"` + SampleCountFloat *float64 `protobuf:"fixed64,4,opt,name=sample_count_float,json=sampleCountFloat" json:"sample_count_float,omitempty"` + SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"` + // Buckets for the conventional histogram. + Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"` + // schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8. // They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and // then each power of two is divided into 2^n logarithmic buckets. // Or in other words, each bucket boundary is the previous boundary times 2^(2^-n). // In the future, more bucket schemas may be added using numbers < -4 or > 8. - SbSchema *int32 `protobuf:"zigzag32,4,opt,name=sb_schema,json=sbSchema" json:"sb_schema,omitempty"` - SbZeroThreshold *float64 `protobuf:"fixed64,5,opt,name=sb_zero_threshold,json=sbZeroThreshold" json:"sb_zero_threshold,omitempty"` - SbZeroCount *uint64 `protobuf:"varint,6,opt,name=sb_zero_count,json=sbZeroCount" json:"sb_zero_count,omitempty"` - SbZeroCountFloat *float64 `protobuf:"fixed64,10,opt,name=sb_zero_count_float,json=sbZeroCountFloat" json:"sb_zero_count_float,omitempty"` - SbNegative *SparseBuckets `protobuf:"bytes,7,opt,name=sb_negative,json=sbNegative" json:"sb_negative,omitempty"` - SbPositive *SparseBuckets `protobuf:"bytes,8,opt,name=sb_positive,json=sbPositive" json:"sb_positive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Schema *int32 `protobuf:"zigzag32,5,opt,name=schema" json:"schema,omitempty"` + ZeroThreshold *float64 `protobuf:"fixed64,6,opt,name=zero_threshold,json=zeroThreshold" json:"zero_threshold,omitempty"` + ZeroCount *uint64 `protobuf:"varint,7,opt,name=zero_count,json=zeroCount" json:"zero_count,omitempty"` + ZeroCountFloat *float64 `protobuf:"fixed64,8,opt,name=zero_count_float,json=zeroCountFloat" json:"zero_count_float,omitempty"` + // Negative buckets for the native histogram. + NegativeSpan []*BucketSpan `protobuf:"bytes,9,rep,name=negative_span,json=negativeSpan" json:"negative_span,omitempty"` + // Use either "negative_delta" or "negative_count", the former for + // regular histograms with integer counts, the latter for float + // histograms. + NegativeDelta []int64 `protobuf:"zigzag64,10,rep,name=negative_delta,json=negativeDelta" json:"negative_delta,omitempty"` + NegativeCount []float64 `protobuf:"fixed64,11,rep,name=negative_count,json=negativeCount" json:"negative_count,omitempty"` + // Positive buckets for the native histogram. + PositiveSpan []*BucketSpan `protobuf:"bytes,12,rep,name=positive_span,json=positiveSpan" json:"positive_span,omitempty"` + // Use either "positive_delta" or "positive_count", the former for + // regular histograms with integer counts, the latter for float + // histograms. + PositiveDelta []int64 `protobuf:"zigzag64,13,rep,name=positive_delta,json=positiveDelta" json:"positive_delta,omitempty"` + PositiveCount []float64 `protobuf:"fixed64,14,rep,name=positive_count,json=positiveCount" json:"positive_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Histogram) Reset() { *m = Histogram{} } @@ -428,48 +440,78 @@ func (m *Histogram) GetBucket() []*Bucket { return nil } -func (m *Histogram) GetSbSchema() int32 { - if m != nil && m.SbSchema != nil { - return *m.SbSchema +func (m *Histogram) GetSchema() int32 { + if m != nil && m.Schema != nil { + return *m.Schema } return 0 } -func (m *Histogram) GetSbZeroThreshold() float64 { - if m != nil && m.SbZeroThreshold != nil { - return *m.SbZeroThreshold +func (m *Histogram) GetZeroThreshold() float64 { + if m != nil && m.ZeroThreshold != nil { + return *m.ZeroThreshold } return 0 } -func (m *Histogram) GetSbZeroCount() uint64 { - if m != nil && m.SbZeroCount != nil { - return *m.SbZeroCount +func (m *Histogram) GetZeroCount() uint64 { + if m != nil && m.ZeroCount != nil { + return *m.ZeroCount } return 0 } -func (m *Histogram) GetSbZeroCountFloat() float64 { - if m != nil && m.SbZeroCountFloat != nil { - return *m.SbZeroCountFloat +func (m *Histogram) GetZeroCountFloat() float64 { + if m != nil && m.ZeroCountFloat != nil { + return *m.ZeroCountFloat } return 0 } -func (m *Histogram) GetSbNegative() *SparseBuckets { +func (m *Histogram) GetNegativeSpan() []*BucketSpan { + if m != nil { + return m.NegativeSpan + } + return nil +} + +func (m *Histogram) GetNegativeDelta() []int64 { if m != nil { - return m.SbNegative + return m.NegativeDelta } return nil } -func (m *Histogram) GetSbPositive() *SparseBuckets { +func (m *Histogram) GetNegativeCount() []float64 { if m != nil { - return m.SbPositive + return m.NegativeCount } return nil } +func (m *Histogram) GetPositiveSpan() []*BucketSpan { + if m != nil { + return m.PositiveSpan + } + return nil +} + +func (m *Histogram) GetPositiveDelta() []int64 { + if m != nil { + return m.PositiveDelta + } + return nil +} + +func (m *Histogram) GetPositiveCount() []float64 { + if m != nil { + return m.PositiveCount + } + return nil +} + +// A Bucket of a conventional histogram, each of which is treated as +// an individual counter-like time series by Prometheus. type Bucket struct { CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"` CumulativeCountFloat *float64 `protobuf:"fixed64,4,opt,name=cumulative_count_float,json=cumulativeCountFloat" json:"cumulative_count_float,omitempty"` @@ -533,64 +575,13 @@ func (m *Bucket) GetExemplar() *Exemplar { return nil } -type SparseBuckets struct { - Span []*SparseBuckets_Span `protobuf:"bytes,1,rep,name=span" json:"span,omitempty"` - // Only one of "delta" or "count" may be used, the former for regular - // histograms with integer counts, the latter for float histograms. - Delta []int64 `protobuf:"zigzag64,2,rep,name=delta" json:"delta,omitempty"` - Count []float64 `protobuf:"fixed64,3,rep,name=count" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SparseBuckets) Reset() { *m = SparseBuckets{} } -func (m *SparseBuckets) String() string { return proto.CompactTextString(m) } -func (*SparseBuckets) ProtoMessage() {} -func (*SparseBuckets) Descriptor() ([]byte, []int) { - return fileDescriptor_d1e5ddb18987a258, []int{8} -} - -func (m *SparseBuckets) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SparseBuckets.Unmarshal(m, b) -} -func (m *SparseBuckets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SparseBuckets.Marshal(b, m, deterministic) -} -func (m *SparseBuckets) XXX_Merge(src proto.Message) { - xxx_messageInfo_SparseBuckets.Merge(m, src) -} -func (m *SparseBuckets) XXX_Size() int { - return xxx_messageInfo_SparseBuckets.Size(m) -} -func (m *SparseBuckets) XXX_DiscardUnknown() { - xxx_messageInfo_SparseBuckets.DiscardUnknown(m) -} - -var xxx_messageInfo_SparseBuckets proto.InternalMessageInfo - -func (m *SparseBuckets) GetSpan() []*SparseBuckets_Span { - if m != nil { - return m.Span - } - return nil -} - -func (m *SparseBuckets) GetDelta() []int64 { - if m != nil { - return m.Delta - } - return nil -} - -func (m *SparseBuckets) GetCount() []float64 { - if m != nil { - return m.Count - } - return nil -} - -type SparseBuckets_Span struct { +// A BucketSpan defines a number of consecutive buckets in a native +// histogram with their offset. Logically, it would be more +// straightforward to include the bucket counts in the Span. However, +// the protobuf representation is more compact in the way the data is +// structured here (with all the buckets in a single array separate +// from the Spans). +type BucketSpan struct { Offset *int32 `protobuf:"zigzag32,1,opt,name=offset" json:"offset,omitempty"` Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -598,39 +589,39 @@ type SparseBuckets_Span struct { XXX_sizecache int32 `json:"-"` } -func (m *SparseBuckets_Span) Reset() { *m = SparseBuckets_Span{} } -func (m *SparseBuckets_Span) String() string { return proto.CompactTextString(m) } -func (*SparseBuckets_Span) ProtoMessage() {} -func (*SparseBuckets_Span) Descriptor() ([]byte, []int) { - return fileDescriptor_d1e5ddb18987a258, []int{8, 0} +func (m *BucketSpan) Reset() { *m = BucketSpan{} } +func (m *BucketSpan) String() string { return proto.CompactTextString(m) } +func (*BucketSpan) ProtoMessage() {} +func (*BucketSpan) Descriptor() ([]byte, []int) { + return fileDescriptor_d1e5ddb18987a258, []int{8} } -func (m *SparseBuckets_Span) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SparseBuckets_Span.Unmarshal(m, b) +func (m *BucketSpan) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BucketSpan.Unmarshal(m, b) } -func (m *SparseBuckets_Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SparseBuckets_Span.Marshal(b, m, deterministic) +func (m *BucketSpan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BucketSpan.Marshal(b, m, deterministic) } -func (m *SparseBuckets_Span) XXX_Merge(src proto.Message) { - xxx_messageInfo_SparseBuckets_Span.Merge(m, src) +func (m *BucketSpan) XXX_Merge(src proto.Message) { + xxx_messageInfo_BucketSpan.Merge(m, src) } -func (m *SparseBuckets_Span) XXX_Size() int { - return xxx_messageInfo_SparseBuckets_Span.Size(m) +func (m *BucketSpan) XXX_Size() int { + return xxx_messageInfo_BucketSpan.Size(m) } -func (m *SparseBuckets_Span) XXX_DiscardUnknown() { - xxx_messageInfo_SparseBuckets_Span.DiscardUnknown(m) +func (m *BucketSpan) XXX_DiscardUnknown() { + xxx_messageInfo_BucketSpan.DiscardUnknown(m) } -var xxx_messageInfo_SparseBuckets_Span proto.InternalMessageInfo +var xxx_messageInfo_BucketSpan proto.InternalMessageInfo -func (m *SparseBuckets_Span) GetOffset() int32 { +func (m *BucketSpan) GetOffset() int32 { if m != nil && m.Offset != nil { return *m.Offset } return 0 } -func (m *SparseBuckets_Span) GetLength() uint32 { +func (m *BucketSpan) GetLength() uint32 { if m != nil && m.Length != nil { return *m.Length } @@ -852,8 +843,7 @@ func init() { proto.RegisterType((*Untyped)(nil), "io.prometheus.client.Untyped") proto.RegisterType((*Histogram)(nil), "io.prometheus.client.Histogram") proto.RegisterType((*Bucket)(nil), "io.prometheus.client.Bucket") - proto.RegisterType((*SparseBuckets)(nil), "io.prometheus.client.SparseBuckets") - proto.RegisterType((*SparseBuckets_Span)(nil), "io.prometheus.client.SparseBuckets.Span") + proto.RegisterType((*BucketSpan)(nil), "io.prometheus.client.BucketSpan") proto.RegisterType((*Exemplar)(nil), "io.prometheus.client.Exemplar") proto.RegisterType((*Metric)(nil), "io.prometheus.client.Metric") proto.RegisterType((*MetricFamily)(nil), "io.prometheus.client.MetricFamily") @@ -864,63 +854,61 @@ func init() { } var fileDescriptor_d1e5ddb18987a258 = []byte{ - // 914 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x72, 0xdb, 0x44, - 0x14, 0x46, 0xb1, 0xfc, 0xa3, 0xe3, 0x86, 0x38, 0xdb, 0x4c, 0xc7, 0x93, 0x12, 0x62, 0xc4, 0x4d, - 0xe8, 0x80, 0x3c, 0x74, 0x52, 0x60, 0x4a, 0xb9, 0x48, 0xda, 0x34, 0x65, 0x06, 0xa7, 0x61, 0x6d, - 0x5f, 0xb4, 0x5c, 0x68, 0x56, 0xf6, 0x46, 0xd6, 0xa0, 0xd5, 0x0a, 0xad, 0xd4, 0x21, 0xbc, 0x00, - 0xd7, 0xbc, 0x02, 0x6f, 0xc0, 0x4b, 0xf0, 0x0e, 0x3c, 0x0d, 0xcc, 0xfe, 0x48, 0x8a, 0x8b, 0x0c, - 0x6d, 0xef, 0x74, 0xce, 0x7e, 0xdf, 0xd1, 0xf9, 0x8e, 0x76, 0xbf, 0x15, 0xb8, 0x11, 0x1f, 0xa7, - 0x19, 0x67, 0x34, 0x5f, 0xd1, 0x42, 0x8c, 0x17, 0x71, 0x44, 0x93, 0x7c, 0xcc, 0x68, 0x9e, 0x45, - 0x0b, 0xe1, 0xa5, 0x19, 0xcf, 0x39, 0xda, 0x8b, 0xb8, 0x57, 0x63, 0x3c, 0x8d, 0xd9, 0x3f, 0x0c, - 0x39, 0x0f, 0x63, 0x3a, 0x56, 0x98, 0xa0, 0xb8, 0x1a, 0xe7, 0x11, 0xa3, 0x22, 0x27, 0x2c, 0xd5, - 0x34, 0xf7, 0x01, 0x38, 0xdf, 0x91, 0x80, 0xc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0x16, 0x9c, 0xfd, 0xfb, 0x77, 0xc4, 0x67, 0x7c, 0x49, 0xe3, 0x71, 0xc8, 0xbf, 0x8e, 0xb8, 0x5f, - 0xaf, 0xfa, 0x7a, 0xf5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0x31, 0xb7, 0xd8, 0xc3, 0x08, - 0x00, 0x00, + // 896 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x8e, 0xdb, 0x44, + 0x18, 0xc5, 0x9b, 0x5f, 0x7f, 0xd9, 0x6c, 0xd3, 0x61, 0x55, 0x59, 0x0b, 0xcb, 0x06, 0x4b, 0x48, + 0x0b, 0x42, 0x8e, 0x40, 0x5b, 0x81, 0x0a, 0x5c, 0xec, 0xb6, 0xe9, 0x16, 0x89, 0xb4, 0x65, 0x92, + 0x5c, 0x14, 0x2e, 0xac, 0x49, 0x32, 0xeb, 0x58, 0x78, 0x3c, 0xc6, 0x1e, 0x57, 0x2c, 0x2f, 0xc0, + 0x35, 0xaf, 0xc0, 0xc3, 0xf0, 0x22, 0x3c, 0x08, 0x68, 0xfe, 0xec, 0xdd, 0xe2, 0x94, 0xd2, 0x3b, + 0x7f, 0x67, 0xce, 0xf7, 0xcd, 0x39, 0xe3, 0xc9, 0x71, 0xc0, 0x8f, 0xf9, 0x24, 0xcb, 0x39, 0xa3, + 0x62, 0x4b, 0xcb, 0x62, 0xb2, 0x4e, 0x62, 0x9a, 0x8a, 0x09, 0xa3, 0x22, 0x8f, 0xd7, 0x45, 0x90, + 0xe5, 0x5c, 0x70, 0x74, 0x18, 0xf3, 0xa0, 0xe6, 0x04, 0x9a, 0x73, 0x74, 0x12, 0x71, 0x1e, 0x25, + 0x74, 0xa2, 0x38, 0xab, 0xf2, 0x6a, 0x22, 0x62, 0x46, 0x0b, 0x41, 0x58, 0xa6, 0xdb, 0xfc, 0xfb, + 0xe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64, 0x12, 0xf1, 0xaf, 0x62, 0x1e, 0xd6, 0xab, + 0xa1, 0x5e, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x16, 0x77, 0x81, 0x98, 0xd7, 0x08, 0x00, 0x00, } diff --git a/io/prometheus/client/metrics.proto b/io/prometheus/client/metrics.proto index 21a6955..f838da6 100644 --- a/io/prometheus/client/metrics.proto +++ b/io/prometheus/client/metrics.proto @@ -65,23 +65,42 @@ message Untyped { message Histogram { optional uint64 sample_count = 1; - optional double sample_count_float = 9; // Overrides sample_count if > 0. + optional double sample_count_float = 4; // Overrides sample_count if > 0. optional double sample_sum = 2; + // Buckets for the conventional histogram. repeated Bucket bucket = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional. - // Sparse bucket (sb) stuff: - // The sb_schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8. + + // Everything below here is for native histograms (also known as sparse histograms). + + // schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8. // They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and // then each power of two is divided into 2^n logarithmic buckets. // Or in other words, each bucket boundary is the previous boundary times 2^(2^-n). // In the future, more bucket schemas may be added using numbers < -4 or > 8. - optional sint32 sb_schema = 4; - optional double sb_zero_threshold = 5; // Breadth of the zero bucket. - optional uint64 sb_zero_count = 6; // Count in zero bucket. - optional double sb_zero_count_float = 10; // Overrides sb_zero_count if > 0. - optional SparseBuckets sb_negative = 7; // Negative sparse buckets. - optional SparseBuckets sb_positive = 8; // Positive sparse buckets. + optional sint32 schema = 5; + optional double zero_threshold = 6; // Breadth of the zero bucket. + optional uint64 zero_count = 7; // Count in zero bucket. + optional double zero_count_float = 8; // Overrides sb_zero_count if > 0. + + // Negative buckets for the native histogram. + repeated BucketSpan negative_span = 9; + // Use either "negative_delta" or "negative_count", the former for + // regular histograms with integer counts, the latter for float + // histograms. + repeated sint64 negative_delta = 10; // Count delta of each bucket compared to previous one (or to zero for 1st bucket). + repeated double negative_count = 11; // Absolute count of each bucket. + + // Positive buckets for the native histogram. + repeated BucketSpan positive_span = 12; + // Use either "positive_delta" or "positive_count", the former for + // regular histograms with integer counts, the latter for float + // histograms. + repeated sint64 positive_delta = 13; // Count delta of each bucket compared to previous one (or to zero for 1st bucket). + repeated double positive_count = 14; // Absolute count of each bucket. } +// A Bucket of a conventional histogram, each of which is treated as +// an individual counter-like time series by Prometheus. message Bucket { optional uint64 cumulative_count = 1; // Cumulative in increasing order. optional double cumulative_count_float = 4; // Overrides cumulative_count if > 0. @@ -89,22 +108,15 @@ message Bucket { optional Exemplar exemplar = 3; } -message SparseBuckets { - // A Span is a given number of consecutive buckets at a given - // offset. Logically, it would be more straightforward to include - // the bucket counts in the Span. However, the protobuf - // representation is more compact in the way the data is structured - // here (with all the buckets in a single array separate from the - // Spans). - message Span { - optional sint32 offset = 1; // Gap to previous span, or starting point for 1st span (which can be negative). - optional uint32 length = 2; // Length of consecutive buckets. - } - repeated Span span = 1; - // Only one of "delta" or "count" may be used, the former for regular - // histograms with integer counts, the latter for float histograms. - repeated sint64 delta = 2; // Count delta of each bucket compared to previous one (or to zero for 1st bucket). - repeated double count = 3; // Absolute count of each bucket. +// A BucketSpan defines a number of consecutive buckets in a native +// histogram with their offset. Logically, it would be more +// straightforward to include the bucket counts in the Span. However, +// the protobuf representation is more compact in the way the data is +// structured here (with all the buckets in a single array separate +// from the Spans). +message BucketSpan { + optional sint32 offset = 1; // Gap to previous span, or starting point for 1st span (which can be negative). + optional uint32 length = 2; // Length of consecutive buckets. } message Exemplar {