From ba8397df616abc7da9f110f0d16c8c6e4ac4aeaa Mon Sep 17 00:00:00 2001 From: Junang Li Date: Mon, 22 Jul 2024 01:46:55 -0400 Subject: [PATCH] WIP --- .../remote_storage_adapter/main.go | 6 +- model/textparse/protobufparse.go | 4 +- model/textparse/protobufparse_test.go | 4 +- prompb/io/prometheus/client/metrics.pb.go | 1401 ---- prompb/io/prometheus/client/metrics.proto | 159 - .../prometheus/client/metrics_vtproto.pb.go | 6840 ----------------- prompb/io/prometheus/write/v2/custom.go | 168 - prompb/io/prometheus/write/v2/custom_test.go | 97 - prompb/io/prometheus/write/v2/types_test.go | 20 +- prompb/rwcommon/codec_test.go | 22 +- scrape/clientprotobuf.go | 2 +- scrape/helpers_test.go | 2 +- scrape/manager_test.go | 2 +- scrape/scrape_test.go | 2 +- scripts/tools.go | 1 - storage/remote/chunked.go | 2 +- storage/remote/client.go | 2 +- storage/remote/codec.go | 2 +- storage/remote/codec_test.go | 128 +- .../prometheusremotewrite/helper_test.go | 7 +- storage/remote/queue_manager.go | 7 +- storage/remote/queue_manager_test.go | 143 +- storage/remote/read_handler_test.go | 34 +- storage/remote/read_test.go | 6 +- storage/remote/write_handler.go | 2 +- storage/remote/write_handler_test.go | 52 +- util/fmtutil/format.go | 2 +- util/fmtutil/format_test.go | 64 +- web/federate.go | 2 +- 29 files changed, 258 insertions(+), 8925 deletions(-) delete mode 100644 prompb/io/prometheus/client/metrics.pb.go delete mode 100644 prompb/io/prometheus/client/metrics.proto delete mode 100644 prompb/io/prometheus/client/metrics_vtproto.pb.go delete mode 100644 prompb/io/prometheus/write/v2/custom.go delete mode 100644 prompb/io/prometheus/write/v2/custom_test.go diff --git a/documentation/examples/remote_storage/remote_storage_adapter/main.go b/documentation/examples/remote_storage/remote_storage_adapter/main.go index bb348aba7f..cc373b8c8d 100644 --- a/documentation/examples/remote_storage/remote_storage_adapter/main.go +++ b/documentation/examples/remote_storage/remote_storage_adapter/main.go @@ -28,7 +28,6 @@ import ( "github.com/alecthomas/kingpin/v2" "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/gogo/protobuf/proto" "github.com/golang/snappy" influx "github.com/influxdata/influxdb/client/v2" "github.com/prometheus/client_golang/prometheus" @@ -36,7 +35,6 @@ import ( "github.com/prometheus/common/model" "github.com/prometheus/common/promlog" "github.com/prometheus/common/promlog/flag" - "github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/graphite" "github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/influxdb" "github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/opentsdb" @@ -251,7 +249,7 @@ func serve(logger log.Logger, addr string, writers []writer, readers []reader) e } var req prompb.ReadRequest - if err := proto.Unmarshal(reqBuf, &req); err != nil { + if err := req.Unmarshal(reqBuf); err != nil { level.Error(logger).Log("msg", "Unmarshal error", "err", err.Error()) http.Error(w, err.Error(), http.StatusBadRequest) return @@ -272,7 +270,7 @@ func serve(logger log.Logger, addr string, writers []writer, readers []reader) e return } - data, err := proto.Marshal(resp) + data, err := resp.Marshal() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/model/textparse/protobufparse.go b/model/textparse/protobufparse.go index 10d5a029d5..d44e9227da 100644 --- a/model/textparse/protobufparse.go +++ b/model/textparse/protobufparse.go @@ -31,7 +31,7 @@ import ( "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" - dto "github.com/prometheus/prometheus/prompb/io/prometheus/client" + dto "github.com/prometheus/client_model/go" ) // ProtobufParser is a very inefficient way of unmarshaling the old Prometheus @@ -595,7 +595,7 @@ func readDelimited(b []byte, mf *dto.MetricFamily) (n int, err error) { return 0, fmt.Errorf("protobufparse: insufficient length of buffer, expected at least %d bytes, got %d bytes", totalLength, len(b)) } mf.Reset() - return totalLength, mf.UnmarshalVT(b[varIntLength:totalLength]) + return totalLength, proto.Unmarshal(b[varIntLength:totalLength], mf) } // formatOpenMetricsFloat works like the usual Go string formatting of a fleat diff --git a/model/textparse/protobufparse_test.go b/model/textparse/protobufparse_test.go index e323a6cc8f..af0b3e27b0 100644 --- a/model/textparse/protobufparse_test.go +++ b/model/textparse/protobufparse_test.go @@ -20,16 +20,16 @@ import ( "io" "testing" - "github.com/gogo/protobuf/proto" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/model/exemplar" "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/util/testutil" - dto "github.com/prometheus/prometheus/prompb/io/prometheus/client" + dto "github.com/prometheus/client_model/go" ) func createTestProtoBuf(t *testing.T) *bytes.Buffer { diff --git a/prompb/io/prometheus/client/metrics.pb.go b/prompb/io/prometheus/client/metrics.pb.go deleted file mode 100644 index 7a3bdfb51e..0000000000 --- a/prompb/io/prometheus/client/metrics.pb.go +++ /dev/null @@ -1,1401 +0,0 @@ -// Copyright 2013 Prometheus Team -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This is copied and lightly edited from -// github.com/prometheus/client_model/io/prometheus/client/metrics.proto -// and finally converted to proto3 syntax to make it usable for the -// gogo-protobuf approach taken within prometheus/prometheus. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc (unknown) -// source: io/prometheus/client/metrics.proto - -package client - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type MetricType int32 - -const ( - // COUNTER must use the Metric field "counter". - MetricType_COUNTER MetricType = 0 - // GAUGE must use the Metric field "gauge". - MetricType_GAUGE MetricType = 1 - // SUMMARY must use the Metric field "summary". - MetricType_SUMMARY MetricType = 2 - // UNTYPED must use the Metric field "untyped". - MetricType_UNTYPED MetricType = 3 - // HISTOGRAM must use the Metric field "histogram". - MetricType_HISTOGRAM MetricType = 4 - // GAUGE_HISTOGRAM must use the Metric field "histogram". - MetricType_GAUGE_HISTOGRAM MetricType = 5 -) - -// Enum value maps for MetricType. -var ( - MetricType_name = map[int32]string{ - 0: "COUNTER", - 1: "GAUGE", - 2: "SUMMARY", - 3: "UNTYPED", - 4: "HISTOGRAM", - 5: "GAUGE_HISTOGRAM", - } - MetricType_value = map[string]int32{ - "COUNTER": 0, - "GAUGE": 1, - "SUMMARY": 2, - "UNTYPED": 3, - "HISTOGRAM": 4, - "GAUGE_HISTOGRAM": 5, - } -) - -func (x MetricType) Enum() *MetricType { - p := new(MetricType) - *p = x - return p -} - -func (x MetricType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MetricType) Descriptor() protoreflect.EnumDescriptor { - return file_io_prometheus_client_metrics_proto_enumTypes[0].Descriptor() -} - -func (MetricType) Type() protoreflect.EnumType { - return &file_io_prometheus_client_metrics_proto_enumTypes[0] -} - -func (x MetricType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MetricType.Descriptor instead. -func (MetricType) EnumDescriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{0} -} - -type LabelPair struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *LabelPair) Reset() { - *x = LabelPair{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelPair) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelPair) ProtoMessage() {} - -func (x *LabelPair) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelPair.ProtoReflect.Descriptor instead. -func (*LabelPair) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{0} -} - -func (x *LabelPair) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *LabelPair) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type Gauge struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Gauge) Reset() { - *x = Gauge{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Gauge) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Gauge) ProtoMessage() {} - -func (x *Gauge) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Gauge.ProtoReflect.Descriptor instead. -func (*Gauge) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{1} -} - -func (x *Gauge) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -type Counter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` - Exemplar *Exemplar `protobuf:"bytes,2,opt,name=exemplar,proto3" json:"exemplar,omitempty"` - CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp,omitempty"` -} - -func (x *Counter) Reset() { - *x = Counter{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Counter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Counter) ProtoMessage() {} - -func (x *Counter) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Counter.ProtoReflect.Descriptor instead. -func (*Counter) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{2} -} - -func (x *Counter) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -func (x *Counter) GetExemplar() *Exemplar { - if x != nil { - return x.Exemplar - } - return nil -} - -func (x *Counter) GetCreatedTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.CreatedTimestamp - } - return nil -} - -type Quantile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Quantile float64 `protobuf:"fixed64,1,opt,name=quantile,proto3" json:"quantile,omitempty"` - Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Quantile) Reset() { - *x = Quantile{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Quantile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Quantile) ProtoMessage() {} - -func (x *Quantile) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Quantile.ProtoReflect.Descriptor instead. -func (*Quantile) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{3} -} - -func (x *Quantile) GetQuantile() float64 { - if x != nil { - return x.Quantile - } - return 0 -} - -func (x *Quantile) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -type Summary struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SampleCount uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount,proto3" json:"sample_count,omitempty"` - SampleSum float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum,proto3" json:"sample_sum,omitempty"` - Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile,proto3" json:"quantile,omitempty"` - CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp,omitempty"` -} - -func (x *Summary) Reset() { - *x = Summary{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Summary) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Summary) ProtoMessage() {} - -func (x *Summary) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Summary.ProtoReflect.Descriptor instead. -func (*Summary) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{4} -} - -func (x *Summary) GetSampleCount() uint64 { - if x != nil { - return x.SampleCount - } - return 0 -} - -func (x *Summary) GetSampleSum() float64 { - if x != nil { - return x.SampleSum - } - return 0 -} - -func (x *Summary) GetQuantile() []*Quantile { - if x != nil { - return x.Quantile - } - return nil -} - -func (x *Summary) GetCreatedTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.CreatedTimestamp - } - return nil -} - -type Untyped struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Untyped) Reset() { - *x = Untyped{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Untyped) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Untyped) ProtoMessage() {} - -func (x *Untyped) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Untyped.ProtoReflect.Descriptor instead. -func (*Untyped) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{5} -} - -func (x *Untyped) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -type Histogram struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SampleCount uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount,proto3" json:"sample_count,omitempty"` - SampleCountFloat float64 `protobuf:"fixed64,4,opt,name=sample_count_float,json=sampleCountFloat,proto3" json:"sample_count_float,omitempty"` // Overrides sample_count if > 0. - SampleSum float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum,proto3" json:"sample_sum,omitempty"` - // Buckets for the classic histogram. - Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket,proto3" json:"bucket,omitempty"` // Ordered in increasing order of upper_bound, +Inf bucket is optional. - CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp,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. - Schema int32 `protobuf:"zigzag32,5,opt,name=schema,proto3" json:"schema,omitempty"` - ZeroThreshold float64 `protobuf:"fixed64,6,opt,name=zero_threshold,json=zeroThreshold,proto3" json:"zero_threshold,omitempty"` // Breadth of the zero bucket. - ZeroCount uint64 `protobuf:"varint,7,opt,name=zero_count,json=zeroCount,proto3" json:"zero_count,omitempty"` // Count in zero bucket. - ZeroCountFloat float64 `protobuf:"fixed64,8,opt,name=zero_count_float,json=zeroCountFloat,proto3" json:"zero_count_float,omitempty"` // Overrides sb_zero_count if > 0. - // Negative buckets for the native histogram. - NegativeSpan []*BucketSpan `protobuf:"bytes,9,rep,name=negative_span,json=negativeSpan,proto3" 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,packed,name=negative_delta,json=negativeDelta,proto3" json:"negative_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket). - NegativeCount []float64 `protobuf:"fixed64,11,rep,packed,name=negative_count,json=negativeCount,proto3" json:"negative_count,omitempty"` // Absolute count of each bucket. - // Positive buckets for the native histogram. - // Use a no-op span (offset 0, length 0) for a native histogram without any - // observations yet and with a zero_threshold of 0. Otherwise, it would be - // indistinguishable from a classic histogram. - PositiveSpan []*BucketSpan `protobuf:"bytes,12,rep,name=positive_span,json=positiveSpan,proto3" 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,packed,name=positive_delta,json=positiveDelta,proto3" json:"positive_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket). - PositiveCount []float64 `protobuf:"fixed64,14,rep,packed,name=positive_count,json=positiveCount,proto3" json:"positive_count,omitempty"` // Absolute count of each bucket. - // Only used for native histograms. These exemplars MUST have a timestamp. - Exemplars []*Exemplar `protobuf:"bytes,16,rep,name=exemplars,proto3" json:"exemplars,omitempty"` -} - -func (x *Histogram) Reset() { - *x = Histogram{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Histogram) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Histogram) ProtoMessage() {} - -func (x *Histogram) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Histogram.ProtoReflect.Descriptor instead. -func (*Histogram) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{6} -} - -func (x *Histogram) GetSampleCount() uint64 { - if x != nil { - return x.SampleCount - } - return 0 -} - -func (x *Histogram) GetSampleCountFloat() float64 { - if x != nil { - return x.SampleCountFloat - } - return 0 -} - -func (x *Histogram) GetSampleSum() float64 { - if x != nil { - return x.SampleSum - } - return 0 -} - -func (x *Histogram) GetBucket() []*Bucket { - if x != nil { - return x.Bucket - } - return nil -} - -func (x *Histogram) GetCreatedTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.CreatedTimestamp - } - return nil -} - -func (x *Histogram) GetSchema() int32 { - if x != nil { - return x.Schema - } - return 0 -} - -func (x *Histogram) GetZeroThreshold() float64 { - if x != nil { - return x.ZeroThreshold - } - return 0 -} - -func (x *Histogram) GetZeroCount() uint64 { - if x != nil { - return x.ZeroCount - } - return 0 -} - -func (x *Histogram) GetZeroCountFloat() float64 { - if x != nil { - return x.ZeroCountFloat - } - return 0 -} - -func (x *Histogram) GetNegativeSpan() []*BucketSpan { - if x != nil { - return x.NegativeSpan - } - return nil -} - -func (x *Histogram) GetNegativeDelta() []int64 { - if x != nil { - return x.NegativeDelta - } - return nil -} - -func (x *Histogram) GetNegativeCount() []float64 { - if x != nil { - return x.NegativeCount - } - return nil -} - -func (x *Histogram) GetPositiveSpan() []*BucketSpan { - if x != nil { - return x.PositiveSpan - } - return nil -} - -func (x *Histogram) GetPositiveDelta() []int64 { - if x != nil { - return x.PositiveDelta - } - return nil -} - -func (x *Histogram) GetPositiveCount() []float64 { - if x != nil { - return x.PositiveCount - } - return nil -} - -func (x *Histogram) GetExemplars() []*Exemplar { - if x != nil { - return x.Exemplars - } - return nil -} - -type Bucket struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CumulativeCount uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount,proto3" json:"cumulative_count,omitempty"` // Cumulative in increasing order. - CumulativeCountFloat float64 `protobuf:"fixed64,4,opt,name=cumulative_count_float,json=cumulativeCountFloat,proto3" json:"cumulative_count_float,omitempty"` // Overrides cumulative_count if > 0. - UpperBound float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound,proto3" json:"upper_bound,omitempty"` // Inclusive. - Exemplar *Exemplar `protobuf:"bytes,3,opt,name=exemplar,proto3" json:"exemplar,omitempty"` -} - -func (x *Bucket) Reset() { - *x = Bucket{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Bucket) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Bucket) ProtoMessage() {} - -func (x *Bucket) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Bucket.ProtoReflect.Descriptor instead. -func (*Bucket) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{7} -} - -func (x *Bucket) GetCumulativeCount() uint64 { - if x != nil { - return x.CumulativeCount - } - return 0 -} - -func (x *Bucket) GetCumulativeCountFloat() float64 { - if x != nil { - return x.CumulativeCountFloat - } - return 0 -} - -func (x *Bucket) GetUpperBound() float64 { - if x != nil { - return x.UpperBound - } - return 0 -} - -func (x *Bucket) GetExemplar() *Exemplar { - if x != nil { - return x.Exemplar - } - return nil -} - -// 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 { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Offset int32 `protobuf:"zigzag32,1,opt,name=offset,proto3" json:"offset,omitempty"` // Gap to previous span, or starting point for 1st span (which can be negative). - Length uint32 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` // Length of consecutive buckets. -} - -func (x *BucketSpan) Reset() { - *x = BucketSpan{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BucketSpan) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BucketSpan) ProtoMessage() {} - -func (x *BucketSpan) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BucketSpan.ProtoReflect.Descriptor instead. -func (*BucketSpan) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{8} -} - -func (x *BucketSpan) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *BucketSpan) GetLength() uint32 { - if x != nil { - return x.Length - } - return 0 -} - -type Exemplar struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Label []*LabelPair `protobuf:"bytes,1,rep,name=label,proto3" json:"label,omitempty"` - Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` - Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // OpenMetrics-style. -} - -func (x *Exemplar) Reset() { - *x = Exemplar{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Exemplar) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Exemplar) ProtoMessage() {} - -func (x *Exemplar) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Exemplar.ProtoReflect.Descriptor instead. -func (*Exemplar) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{9} -} - -func (x *Exemplar) GetLabel() []*LabelPair { - if x != nil { - return x.Label - } - return nil -} - -func (x *Exemplar) GetValue() float64 { - if x != nil { - return x.Value - } - return 0 -} - -func (x *Exemplar) GetTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.Timestamp - } - return nil -} - -type Metric struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Label []*LabelPair `protobuf:"bytes,1,rep,name=label,proto3" json:"label,omitempty"` - Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge,proto3" json:"gauge,omitempty"` - Counter *Counter `protobuf:"bytes,3,opt,name=counter,proto3" json:"counter,omitempty"` - Summary *Summary `protobuf:"bytes,4,opt,name=summary,proto3" json:"summary,omitempty"` - Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped,proto3" json:"untyped,omitempty"` - Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram,proto3" json:"histogram,omitempty"` - TimestampMs int64 `protobuf:"varint,6,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"` -} - -func (x *Metric) Reset() { - *x = Metric{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Metric) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Metric) ProtoMessage() {} - -func (x *Metric) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Metric.ProtoReflect.Descriptor instead. -func (*Metric) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{10} -} - -func (x *Metric) GetLabel() []*LabelPair { - if x != nil { - return x.Label - } - return nil -} - -func (x *Metric) GetGauge() *Gauge { - if x != nil { - return x.Gauge - } - return nil -} - -func (x *Metric) GetCounter() *Counter { - if x != nil { - return x.Counter - } - return nil -} - -func (x *Metric) GetSummary() *Summary { - if x != nil { - return x.Summary - } - return nil -} - -func (x *Metric) GetUntyped() *Untyped { - if x != nil { - return x.Untyped - } - return nil -} - -func (x *Metric) GetHistogram() *Histogram { - if x != nil { - return x.Histogram - } - return nil -} - -func (x *Metric) GetTimestampMs() int64 { - if x != nil { - return x.TimestampMs - } - return 0 -} - -type MetricFamily struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Help string `protobuf:"bytes,2,opt,name=help,proto3" json:"help,omitempty"` - Type MetricType `protobuf:"varint,3,opt,name=type,proto3,enum=io.prometheus.client.MetricType" json:"type,omitempty"` - Metric []*Metric `protobuf:"bytes,4,rep,name=metric,proto3" json:"metric,omitempty"` - Unit string `protobuf:"bytes,5,opt,name=unit,proto3" json:"unit,omitempty"` -} - -func (x *MetricFamily) Reset() { - *x = MetricFamily{} - if protoimpl.UnsafeEnabled { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetricFamily) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetricFamily) ProtoMessage() {} - -func (x *MetricFamily) ProtoReflect() protoreflect.Message { - mi := &file_io_prometheus_client_metrics_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetricFamily.ProtoReflect.Descriptor instead. -func (*MetricFamily) Descriptor() ([]byte, []int) { - return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{11} -} - -func (x *MetricFamily) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *MetricFamily) GetHelp() string { - if x != nil { - return x.Help - } - return "" -} - -func (x *MetricFamily) GetType() MetricType { - if x != nil { - return x.Type - } - return MetricType_COUNTER -} - -func (x *MetricFamily) GetMetric() []*Metric { - if x != nil { - return x.Metric - } - return nil -} - -func (x *MetricFamily) GetUnit() string { - if x != nil { - return x.Unit - } - return "" -} - -var File_io_prometheus_client_metrics_proto protoreflect.FileDescriptor - -var file_io_prometheus_client_metrics_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, - 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x09, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x1d, 0x0a, 0x05, 0x47, 0x61, 0x75, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x12, - 0x47, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x3c, 0x0a, 0x08, 0x51, 0x75, 0x61, 0x6e, - 0x74, 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x07, 0x53, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, - 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x53, 0x75, 0x6d, 0x12, 0x3a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, - 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x51, 0x75, - 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65, - 0x12, 0x47, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x1f, 0x0a, 0x07, 0x55, 0x6e, 0x74, - 0x79, 0x70, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xea, 0x05, 0x0a, 0x09, 0x48, - 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x73, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x73, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x75, 0x6d, 0x12, 0x34, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, - 0x65, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x47, - 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, - 0x25, 0x0a, 0x0e, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x7a, 0x65, 0x72, 0x6f, 0x54, 0x68, 0x72, - 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x7a, 0x65, 0x72, 0x6f, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x0e, 0x7a, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, - 0x45, 0x0a, 0x0d, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x73, 0x70, 0x61, 0x6e, - 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, - 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x42, 0x75, - 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x0c, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x12, 0x52, 0x0d, - 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x25, 0x0a, - 0x0e, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x0b, 0x20, 0x03, 0x28, 0x01, 0x52, 0x0d, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, - 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x2e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x0c, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x0d, 0x20, - 0x03, 0x28, 0x12, 0x52, 0x0d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, - 0x74, 0x61, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x01, 0x52, 0x0d, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x65, 0x78, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x09, 0x65, 0x78, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x42, 0x75, 0x63, 0x6b, - 0x65, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x63, 0x75, - 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, - 0x16, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x14, 0x63, - 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c, - 0x6f, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x75, 0x70, 0x70, 0x65, 0x72, 0x42, - 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, - 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, - 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, - 0x22, 0x3c, 0x0a, 0x0a, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x16, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x91, - 0x01, 0x0a, 0x08, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x12, 0x35, 0x0a, 0x05, 0x6c, - 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x6c, 0x61, 0x62, - 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x22, 0xff, 0x02, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x35, 0x0a, - 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x6c, - 0x61, 0x62, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, - 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x61, 0x75, 0x67, 0x65, - 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x37, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, - 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, - 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x75, 0x6e, 0x74, - 0x79, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x2e, 0x55, 0x6e, 0x74, 0x79, 0x70, 0x65, 0x64, 0x52, 0x07, 0x75, 0x6e, 0x74, 0x79, 0x70, - 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x69, 0x73, - 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, - 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x4d, 0x73, 0x22, 0xb6, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x46, - 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x6c, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x12, 0x34, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x69, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, - 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x2a, 0x62, 0x0a, - 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, - 0x4f, 0x55, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x41, 0x55, 0x47, - 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x4d, 0x4d, 0x41, 0x52, 0x59, 0x10, 0x02, - 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x54, 0x59, 0x50, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, - 0x47, 0x41, 0x55, 0x47, 0x45, 0x5f, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, - 0x05, 0x42, 0xd8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x42, 0x0c, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x62, 0x2f, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0xa2, 0x02, 0x03, 0x49, - 0x50, 0x43, 0xaa, 0x02, 0x14, 0x49, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, - 0x75, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0xca, 0x02, 0x14, 0x49, 0x6f, 0x5c, 0x50, - 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x5c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0xe2, 0x02, 0x20, 0x49, 0x6f, 0x5c, 0x50, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, - 0x5c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x49, 0x6f, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6d, 0x65, 0x74, - 0x68, 0x65, 0x75, 0x73, 0x3a, 0x3a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_io_prometheus_client_metrics_proto_rawDescOnce sync.Once - file_io_prometheus_client_metrics_proto_rawDescData = file_io_prometheus_client_metrics_proto_rawDesc -) - -func file_io_prometheus_client_metrics_proto_rawDescGZIP() []byte { - file_io_prometheus_client_metrics_proto_rawDescOnce.Do(func() { - file_io_prometheus_client_metrics_proto_rawDescData = protoimpl.X.CompressGZIP(file_io_prometheus_client_metrics_proto_rawDescData) - }) - return file_io_prometheus_client_metrics_proto_rawDescData -} - -var file_io_prometheus_client_metrics_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_io_prometheus_client_metrics_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_io_prometheus_client_metrics_proto_goTypes = []any{ - (MetricType)(0), // 0: io.prometheus.client.MetricType - (*LabelPair)(nil), // 1: io.prometheus.client.LabelPair - (*Gauge)(nil), // 2: io.prometheus.client.Gauge - (*Counter)(nil), // 3: io.prometheus.client.Counter - (*Quantile)(nil), // 4: io.prometheus.client.Quantile - (*Summary)(nil), // 5: io.prometheus.client.Summary - (*Untyped)(nil), // 6: io.prometheus.client.Untyped - (*Histogram)(nil), // 7: io.prometheus.client.Histogram - (*Bucket)(nil), // 8: io.prometheus.client.Bucket - (*BucketSpan)(nil), // 9: io.prometheus.client.BucketSpan - (*Exemplar)(nil), // 10: io.prometheus.client.Exemplar - (*Metric)(nil), // 11: io.prometheus.client.Metric - (*MetricFamily)(nil), // 12: io.prometheus.client.MetricFamily - (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp -} -var file_io_prometheus_client_metrics_proto_depIdxs = []int32{ - 10, // 0: io.prometheus.client.Counter.exemplar:type_name -> io.prometheus.client.Exemplar - 13, // 1: io.prometheus.client.Counter.created_timestamp:type_name -> google.protobuf.Timestamp - 4, // 2: io.prometheus.client.Summary.quantile:type_name -> io.prometheus.client.Quantile - 13, // 3: io.prometheus.client.Summary.created_timestamp:type_name -> google.protobuf.Timestamp - 8, // 4: io.prometheus.client.Histogram.bucket:type_name -> io.prometheus.client.Bucket - 13, // 5: io.prometheus.client.Histogram.created_timestamp:type_name -> google.protobuf.Timestamp - 9, // 6: io.prometheus.client.Histogram.negative_span:type_name -> io.prometheus.client.BucketSpan - 9, // 7: io.prometheus.client.Histogram.positive_span:type_name -> io.prometheus.client.BucketSpan - 10, // 8: io.prometheus.client.Histogram.exemplars:type_name -> io.prometheus.client.Exemplar - 10, // 9: io.prometheus.client.Bucket.exemplar:type_name -> io.prometheus.client.Exemplar - 1, // 10: io.prometheus.client.Exemplar.label:type_name -> io.prometheus.client.LabelPair - 13, // 11: io.prometheus.client.Exemplar.timestamp:type_name -> google.protobuf.Timestamp - 1, // 12: io.prometheus.client.Metric.label:type_name -> io.prometheus.client.LabelPair - 2, // 13: io.prometheus.client.Metric.gauge:type_name -> io.prometheus.client.Gauge - 3, // 14: io.prometheus.client.Metric.counter:type_name -> io.prometheus.client.Counter - 5, // 15: io.prometheus.client.Metric.summary:type_name -> io.prometheus.client.Summary - 6, // 16: io.prometheus.client.Metric.untyped:type_name -> io.prometheus.client.Untyped - 7, // 17: io.prometheus.client.Metric.histogram:type_name -> io.prometheus.client.Histogram - 0, // 18: io.prometheus.client.MetricFamily.type:type_name -> io.prometheus.client.MetricType - 11, // 19: io.prometheus.client.MetricFamily.metric:type_name -> io.prometheus.client.Metric - 20, // [20:20] is the sub-list for method output_type - 20, // [20:20] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name -} - -func init() { file_io_prometheus_client_metrics_proto_init() } -func file_io_prometheus_client_metrics_proto_init() { - if File_io_prometheus_client_metrics_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_io_prometheus_client_metrics_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*LabelPair); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*Gauge); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*Counter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*Quantile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*Summary); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*Untyped); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*Histogram); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*Bucket); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*BucketSpan); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*Exemplar); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*Metric); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_io_prometheus_client_metrics_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*MetricFamily); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_io_prometheus_client_metrics_proto_rawDesc, - NumEnums: 1, - NumMessages: 12, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_io_prometheus_client_metrics_proto_goTypes, - DependencyIndexes: file_io_prometheus_client_metrics_proto_depIdxs, - EnumInfos: file_io_prometheus_client_metrics_proto_enumTypes, - MessageInfos: file_io_prometheus_client_metrics_proto_msgTypes, - }.Build() - File_io_prometheus_client_metrics_proto = out.File - file_io_prometheus_client_metrics_proto_rawDesc = nil - file_io_prometheus_client_metrics_proto_goTypes = nil - file_io_prometheus_client_metrics_proto_depIdxs = nil -} diff --git a/prompb/io/prometheus/client/metrics.proto b/prompb/io/prometheus/client/metrics.proto deleted file mode 100644 index 445461655c..0000000000 --- a/prompb/io/prometheus/client/metrics.proto +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2013 Prometheus Team -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This is copied and lightly edited from -// github.com/prometheus/client_model/io/prometheus/client/metrics.proto -// and finally converted to proto3 syntax to make it usable for the -// gogo-protobuf approach taken within prometheus/prometheus. - -syntax = "proto3"; - -package io.prometheus.client; -option go_package = "io_prometheus_client"; - -import "google/protobuf/timestamp.proto"; - -message LabelPair { - string name = 1; - string value = 2; -} - -enum MetricType { - // COUNTER must use the Metric field "counter". - COUNTER = 0; - // GAUGE must use the Metric field "gauge". - GAUGE = 1; - // SUMMARY must use the Metric field "summary". - SUMMARY = 2; - // UNTYPED must use the Metric field "untyped". - UNTYPED = 3; - // HISTOGRAM must use the Metric field "histogram". - HISTOGRAM = 4; - // GAUGE_HISTOGRAM must use the Metric field "histogram". - GAUGE_HISTOGRAM = 5; -} - -message Gauge { - double value = 1; -} - -message Counter { - double value = 1; - Exemplar exemplar = 2; - - google.protobuf.Timestamp created_timestamp = 3; -} - -message Quantile { - double quantile = 1; - double value = 2; -} - -message Summary { - uint64 sample_count = 1; - double sample_sum = 2; - repeated Quantile quantile = 3; - - google.protobuf.Timestamp created_timestamp = 4; -} - -message Untyped { - double value = 1; -} - -message Histogram { - uint64 sample_count = 1; - double sample_count_float = 4; // Overrides sample_count if > 0. - double sample_sum = 2; - // Buckets for the classic histogram. - repeated Bucket bucket = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional. - - google.protobuf.Timestamp created_timestamp = 15; - - // Everything below here is for native histograms (also known as sparse histograms). - // Native histograms are an experimental feature without stability guarantees. - - // 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. - sint32 schema = 5; - double zero_threshold = 6; // Breadth of the zero bucket. - uint64 zero_count = 7; // Count in zero bucket. - 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. - // Use a no-op span (offset 0, length 0) for a native histogram without any - // observations yet and with a zero_threshold of 0. Otherwise, it would be - // indistinguishable from a classic 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. - - // Only used for native histograms. These exemplars MUST have a timestamp. - repeated Exemplar exemplars = 16; -} - -message Bucket { - uint64 cumulative_count = 1; // Cumulative in increasing order. - double cumulative_count_float = 4; // Overrides cumulative_count if > 0. - double upper_bound = 2; // Inclusive. - Exemplar exemplar = 3; -} - -// 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 { - sint32 offset = 1; // Gap to previous span, or starting point for 1st span (which can be negative). - uint32 length = 2; // Length of consecutive buckets. -} - -message Exemplar { - repeated LabelPair label = 1; - double value = 2; - google.protobuf.Timestamp timestamp = 3; // OpenMetrics-style. -} - -message Metric { - repeated LabelPair label = 1; - Gauge gauge = 2; - Counter counter = 3; - Summary summary = 4; - Untyped untyped = 5; - Histogram histogram = 7; - int64 timestamp_ms = 6; -} - -message MetricFamily { - string name = 1; - string help = 2; - MetricType type = 3; - repeated Metric metric = 4; - string unit = 5; -} diff --git a/prompb/io/prometheus/client/metrics_vtproto.pb.go b/prompb/io/prometheus/client/metrics_vtproto.pb.go deleted file mode 100644 index b89aa2ae1e..0000000000 --- a/prompb/io/prometheus/client/metrics_vtproto.pb.go +++ /dev/null @@ -1,6840 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: io/prometheus/client/metrics.proto - -package client - -import ( - binary "encoding/binary" - fmt "fmt" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - timestamppb1 "github.com/planetscale/vtprotobuf/types/known/timestamppb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *LabelPair) CloneVT() *LabelPair { - if m == nil { - return (*LabelPair)(nil) - } - r := new(LabelPair) - r.Name = m.Name - r.Value = m.Value - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *LabelPair) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Gauge) CloneVT() *Gauge { - if m == nil { - return (*Gauge)(nil) - } - r := new(Gauge) - r.Value = m.Value - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Gauge) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Counter) CloneVT() *Counter { - if m == nil { - return (*Counter)(nil) - } - r := new(Counter) - r.Value = m.Value - r.Exemplar = m.Exemplar.CloneVT() - r.CreatedTimestamp = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.CreatedTimestamp).CloneVT()) - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Counter) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Quantile) CloneVT() *Quantile { - if m == nil { - return (*Quantile)(nil) - } - r := new(Quantile) - r.Quantile = m.Quantile - r.Value = m.Value - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Quantile) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Summary) CloneVT() *Summary { - if m == nil { - return (*Summary)(nil) - } - r := new(Summary) - r.SampleCount = m.SampleCount - r.SampleSum = m.SampleSum - r.CreatedTimestamp = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.CreatedTimestamp).CloneVT()) - if rhs := m.Quantile; rhs != nil { - tmpContainer := make([]*Quantile, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Quantile = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Summary) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Untyped) CloneVT() *Untyped { - if m == nil { - return (*Untyped)(nil) - } - r := new(Untyped) - r.Value = m.Value - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Untyped) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Histogram) CloneVT() *Histogram { - if m == nil { - return (*Histogram)(nil) - } - r := new(Histogram) - r.SampleCount = m.SampleCount - r.SampleCountFloat = m.SampleCountFloat - r.SampleSum = m.SampleSum - r.CreatedTimestamp = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.CreatedTimestamp).CloneVT()) - r.Schema = m.Schema - r.ZeroThreshold = m.ZeroThreshold - r.ZeroCount = m.ZeroCount - r.ZeroCountFloat = m.ZeroCountFloat - if rhs := m.Bucket; rhs != nil { - tmpContainer := make([]*Bucket, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Bucket = tmpContainer - } - if rhs := m.NegativeSpan; rhs != nil { - tmpContainer := make([]*BucketSpan, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.NegativeSpan = tmpContainer - } - if rhs := m.NegativeDelta; rhs != nil { - tmpContainer := make([]int64, len(rhs)) - copy(tmpContainer, rhs) - r.NegativeDelta = tmpContainer - } - if rhs := m.NegativeCount; rhs != nil { - tmpContainer := make([]float64, len(rhs)) - copy(tmpContainer, rhs) - r.NegativeCount = tmpContainer - } - if rhs := m.PositiveSpan; rhs != nil { - tmpContainer := make([]*BucketSpan, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.PositiveSpan = tmpContainer - } - if rhs := m.PositiveDelta; rhs != nil { - tmpContainer := make([]int64, len(rhs)) - copy(tmpContainer, rhs) - r.PositiveDelta = tmpContainer - } - if rhs := m.PositiveCount; rhs != nil { - tmpContainer := make([]float64, len(rhs)) - copy(tmpContainer, rhs) - r.PositiveCount = tmpContainer - } - if rhs := m.Exemplars; rhs != nil { - tmpContainer := make([]*Exemplar, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Exemplars = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Histogram) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Bucket) CloneVT() *Bucket { - if m == nil { - return (*Bucket)(nil) - } - r := new(Bucket) - r.CumulativeCount = m.CumulativeCount - r.CumulativeCountFloat = m.CumulativeCountFloat - r.UpperBound = m.UpperBound - r.Exemplar = m.Exemplar.CloneVT() - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Bucket) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *BucketSpan) CloneVT() *BucketSpan { - if m == nil { - return (*BucketSpan)(nil) - } - r := new(BucketSpan) - r.Offset = m.Offset - r.Length = m.Length - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *BucketSpan) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Exemplar) CloneVT() *Exemplar { - if m == nil { - return (*Exemplar)(nil) - } - r := new(Exemplar) - r.Value = m.Value - r.Timestamp = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.Timestamp).CloneVT()) - if rhs := m.Label; rhs != nil { - tmpContainer := make([]*LabelPair, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Label = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Exemplar) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Metric) CloneVT() *Metric { - if m == nil { - return (*Metric)(nil) - } - r := new(Metric) - r.Gauge = m.Gauge.CloneVT() - r.Counter = m.Counter.CloneVT() - r.Summary = m.Summary.CloneVT() - r.Untyped = m.Untyped.CloneVT() - r.Histogram = m.Histogram.CloneVT() - r.TimestampMs = m.TimestampMs - if rhs := m.Label; rhs != nil { - tmpContainer := make([]*LabelPair, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Label = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Metric) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *MetricFamily) CloneVT() *MetricFamily { - if m == nil { - return (*MetricFamily)(nil) - } - r := new(MetricFamily) - r.Name = m.Name - r.Help = m.Help - r.Type = m.Type - r.Unit = m.Unit - if rhs := m.Metric; rhs != nil { - tmpContainer := make([]*Metric, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Metric = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *MetricFamily) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *LabelPair) EqualVT(that *LabelPair) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.Value != that.Value { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *LabelPair) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*LabelPair) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Gauge) EqualVT(that *Gauge) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Value != that.Value { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Gauge) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Gauge) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Counter) EqualVT(that *Counter) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Value != that.Value { - return false - } - if !this.Exemplar.EqualVT(that.Exemplar) { - return false - } - if !(*timestamppb1.Timestamp)(this.CreatedTimestamp).EqualVT((*timestamppb1.Timestamp)(that.CreatedTimestamp)) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Counter) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Counter) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Quantile) EqualVT(that *Quantile) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Quantile != that.Quantile { - return false - } - if this.Value != that.Value { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Quantile) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Quantile) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Summary) EqualVT(that *Summary) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.SampleCount != that.SampleCount { - return false - } - if this.SampleSum != that.SampleSum { - return false - } - if len(this.Quantile) != len(that.Quantile) { - return false - } - for i, vx := range this.Quantile { - vy := that.Quantile[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Quantile{} - } - if q == nil { - q = &Quantile{} - } - if !p.EqualVT(q) { - return false - } - } - } - if !(*timestamppb1.Timestamp)(this.CreatedTimestamp).EqualVT((*timestamppb1.Timestamp)(that.CreatedTimestamp)) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Summary) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Summary) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Untyped) EqualVT(that *Untyped) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Value != that.Value { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Untyped) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Untyped) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Histogram) EqualVT(that *Histogram) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.SampleCount != that.SampleCount { - return false - } - if this.SampleSum != that.SampleSum { - return false - } - if len(this.Bucket) != len(that.Bucket) { - return false - } - for i, vx := range this.Bucket { - vy := that.Bucket[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Bucket{} - } - if q == nil { - q = &Bucket{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.SampleCountFloat != that.SampleCountFloat { - return false - } - if this.Schema != that.Schema { - return false - } - if this.ZeroThreshold != that.ZeroThreshold { - return false - } - if this.ZeroCount != that.ZeroCount { - return false - } - if this.ZeroCountFloat != that.ZeroCountFloat { - return false - } - if len(this.NegativeSpan) != len(that.NegativeSpan) { - return false - } - for i, vx := range this.NegativeSpan { - vy := that.NegativeSpan[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &BucketSpan{} - } - if q == nil { - q = &BucketSpan{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.NegativeDelta) != len(that.NegativeDelta) { - return false - } - for i, vx := range this.NegativeDelta { - vy := that.NegativeDelta[i] - if vx != vy { - return false - } - } - if len(this.NegativeCount) != len(that.NegativeCount) { - return false - } - for i, vx := range this.NegativeCount { - vy := that.NegativeCount[i] - if vx != vy { - return false - } - } - if len(this.PositiveSpan) != len(that.PositiveSpan) { - return false - } - for i, vx := range this.PositiveSpan { - vy := that.PositiveSpan[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &BucketSpan{} - } - if q == nil { - q = &BucketSpan{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.PositiveDelta) != len(that.PositiveDelta) { - return false - } - for i, vx := range this.PositiveDelta { - vy := that.PositiveDelta[i] - if vx != vy { - return false - } - } - if len(this.PositiveCount) != len(that.PositiveCount) { - return false - } - for i, vx := range this.PositiveCount { - vy := that.PositiveCount[i] - if vx != vy { - return false - } - } - if !(*timestamppb1.Timestamp)(this.CreatedTimestamp).EqualVT((*timestamppb1.Timestamp)(that.CreatedTimestamp)) { - return false - } - if len(this.Exemplars) != len(that.Exemplars) { - return false - } - for i, vx := range this.Exemplars { - vy := that.Exemplars[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Exemplar{} - } - if q == nil { - q = &Exemplar{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Histogram) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Histogram) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Bucket) EqualVT(that *Bucket) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.CumulativeCount != that.CumulativeCount { - return false - } - if this.UpperBound != that.UpperBound { - return false - } - if !this.Exemplar.EqualVT(that.Exemplar) { - return false - } - if this.CumulativeCountFloat != that.CumulativeCountFloat { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Bucket) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Bucket) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *BucketSpan) EqualVT(that *BucketSpan) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Offset != that.Offset { - return false - } - if this.Length != that.Length { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *BucketSpan) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*BucketSpan) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Exemplar) EqualVT(that *Exemplar) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Label) != len(that.Label) { - return false - } - for i, vx := range this.Label { - vy := that.Label[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &LabelPair{} - } - if q == nil { - q = &LabelPair{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.Value != that.Value { - return false - } - if !(*timestamppb1.Timestamp)(this.Timestamp).EqualVT((*timestamppb1.Timestamp)(that.Timestamp)) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Exemplar) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Exemplar) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Metric) EqualVT(that *Metric) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Label) != len(that.Label) { - return false - } - for i, vx := range this.Label { - vy := that.Label[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &LabelPair{} - } - if q == nil { - q = &LabelPair{} - } - if !p.EqualVT(q) { - return false - } - } - } - if !this.Gauge.EqualVT(that.Gauge) { - return false - } - if !this.Counter.EqualVT(that.Counter) { - return false - } - if !this.Summary.EqualVT(that.Summary) { - return false - } - if !this.Untyped.EqualVT(that.Untyped) { - return false - } - if this.TimestampMs != that.TimestampMs { - return false - } - if !this.Histogram.EqualVT(that.Histogram) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Metric) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Metric) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *MetricFamily) EqualVT(that *MetricFamily) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.Help != that.Help { - return false - } - if this.Type != that.Type { - return false - } - if len(this.Metric) != len(that.Metric) { - return false - } - for i, vx := range this.Metric { - vy := that.Metric[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Metric{} - } - if q == nil { - q = &Metric{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.Unit != that.Unit { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *MetricFamily) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*MetricFamily) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *LabelPair) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LabelPair) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *LabelPair) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Gauge) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Gauge) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Gauge) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Counter) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Counter) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Counter) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.CreatedTimestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Exemplar != nil { - size, err := m.Exemplar.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Quantile) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Quantile) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Quantile) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x11 - } - if m.Quantile != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Quantile)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Summary) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Summary) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Summary) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.CreatedTimestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if len(m.Quantile) > 0 { - for iNdEx := len(m.Quantile) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Quantile[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.SampleSum != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SampleSum)))) - i-- - dAtA[i] = 0x11 - } - if m.SampleCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.SampleCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Untyped) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Untyped) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Untyped) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Histogram) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Histogram) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Histogram) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Exemplars) > 0 { - for iNdEx := len(m.Exemplars) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Exemplars[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - } - if m.CreatedTimestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x7a - } - if len(m.PositiveCount) > 0 { - for iNdEx := len(m.PositiveCount) - 1; iNdEx >= 0; iNdEx-- { - f1 := math.Float64bits(float64(m.PositiveCount[iNdEx])) - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(f1)) - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PositiveCount)*8)) - i-- - dAtA[i] = 0x72 - } - if len(m.PositiveDelta) > 0 { - var pksize3 int - for _, num := range m.PositiveDelta { - pksize3 += protohelpers.SizeOfZigzag(uint64(num)) - } - i -= pksize3 - j2 := i - for _, num := range m.PositiveDelta { - x4 := (uint64(num) << 1) ^ uint64((num >> 63)) - for x4 >= 1<<7 { - dAtA[j2] = uint8(uint64(x4)&0x7f | 0x80) - j2++ - x4 >>= 7 - } - dAtA[j2] = uint8(x4) - j2++ - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize3)) - i-- - dAtA[i] = 0x6a - } - if len(m.PositiveSpan) > 0 { - for iNdEx := len(m.PositiveSpan) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.PositiveSpan[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - } - if len(m.NegativeCount) > 0 { - for iNdEx := len(m.NegativeCount) - 1; iNdEx >= 0; iNdEx-- { - f5 := math.Float64bits(float64(m.NegativeCount[iNdEx])) - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(f5)) - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.NegativeCount)*8)) - i-- - dAtA[i] = 0x5a - } - if len(m.NegativeDelta) > 0 { - var pksize7 int - for _, num := range m.NegativeDelta { - pksize7 += protohelpers.SizeOfZigzag(uint64(num)) - } - i -= pksize7 - j6 := i - for _, num := range m.NegativeDelta { - x8 := (uint64(num) << 1) ^ uint64((num >> 63)) - for x8 >= 1<<7 { - dAtA[j6] = uint8(uint64(x8)&0x7f | 0x80) - j6++ - x8 >>= 7 - } - dAtA[j6] = uint8(x8) - j6++ - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize7)) - i-- - dAtA[i] = 0x52 - } - if len(m.NegativeSpan) > 0 { - for iNdEx := len(m.NegativeSpan) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.NegativeSpan[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x4a - } - } - if m.ZeroCountFloat != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.ZeroCountFloat)))) - i-- - dAtA[i] = 0x41 - } - if m.ZeroCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ZeroCount)) - i-- - dAtA[i] = 0x38 - } - if m.ZeroThreshold != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.ZeroThreshold)))) - i-- - dAtA[i] = 0x31 - } - if m.Schema != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64((uint32(m.Schema)<<1)^uint32((m.Schema>>31)))) - i-- - dAtA[i] = 0x28 - } - if m.SampleCountFloat != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SampleCountFloat)))) - i-- - dAtA[i] = 0x21 - } - if len(m.Bucket) > 0 { - for iNdEx := len(m.Bucket) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Bucket[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.SampleSum != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SampleSum)))) - i-- - dAtA[i] = 0x11 - } - if m.SampleCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.SampleCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Bucket) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Bucket) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Bucket) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.CumulativeCountFloat != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.CumulativeCountFloat)))) - i-- - dAtA[i] = 0x21 - } - if m.Exemplar != nil { - size, err := m.Exemplar.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.UpperBound != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.UpperBound)))) - i-- - dAtA[i] = 0x11 - } - if m.CumulativeCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CumulativeCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BucketSpan) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BucketSpan) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *BucketSpan) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Length != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x10 - } - if m.Offset != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64((uint32(m.Offset)<<1)^uint32((m.Offset>>31)))) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Exemplar) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Exemplar) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Exemplar) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Timestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.Timestamp).MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x11 - } - if len(m.Label) > 0 { - for iNdEx := len(m.Label) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Label[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Metric) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Metric) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Metric) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Histogram != nil { - size, err := m.Histogram.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if m.TimestampMs != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TimestampMs)) - i-- - dAtA[i] = 0x30 - } - if m.Untyped != nil { - size, err := m.Untyped.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if m.Summary != nil { - size, err := m.Summary.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if m.Counter != nil { - size, err := m.Counter.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Gauge != nil { - size, err := m.Gauge.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if len(m.Label) > 0 { - for iNdEx := len(m.Label) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Label[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MetricFamily) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricFamily) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *MetricFamily) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Unit) > 0 { - i -= len(m.Unit) - copy(dAtA[i:], m.Unit) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Unit))) - i-- - dAtA[i] = 0x2a - } - if len(m.Metric) > 0 { - for iNdEx := len(m.Metric) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Metric[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if m.Type != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x18 - } - if len(m.Help) > 0 { - i -= len(m.Help) - copy(dAtA[i:], m.Help) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Help))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LabelPair) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LabelPair) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *LabelPair) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Gauge) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Gauge) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Gauge) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Counter) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Counter) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Counter) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.CreatedTimestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Exemplar != nil { - size, err := m.Exemplar.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Quantile) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Quantile) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Quantile) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x11 - } - if m.Quantile != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Quantile)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Summary) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Summary) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Summary) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.CreatedTimestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if len(m.Quantile) > 0 { - for iNdEx := len(m.Quantile) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Quantile[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.SampleSum != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SampleSum)))) - i-- - dAtA[i] = 0x11 - } - if m.SampleCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.SampleCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Untyped) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Untyped) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Untyped) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x9 - } - return len(dAtA) - i, nil -} - -func (m *Histogram) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Histogram) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Histogram) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Exemplars) > 0 { - for iNdEx := len(m.Exemplars) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Exemplars[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - } - if m.CreatedTimestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x7a - } - if len(m.PositiveCount) > 0 { - for iNdEx := len(m.PositiveCount) - 1; iNdEx >= 0; iNdEx-- { - f1 := math.Float64bits(float64(m.PositiveCount[iNdEx])) - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(f1)) - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PositiveCount)*8)) - i-- - dAtA[i] = 0x72 - } - if len(m.PositiveDelta) > 0 { - var pksize3 int - for _, num := range m.PositiveDelta { - pksize3 += protohelpers.SizeOfZigzag(uint64(num)) - } - i -= pksize3 - j2 := i - for _, num := range m.PositiveDelta { - x4 := (uint64(num) << 1) ^ uint64((num >> 63)) - for x4 >= 1<<7 { - dAtA[j2] = uint8(uint64(x4)&0x7f | 0x80) - j2++ - x4 >>= 7 - } - dAtA[j2] = uint8(x4) - j2++ - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize3)) - i-- - dAtA[i] = 0x6a - } - if len(m.PositiveSpan) > 0 { - for iNdEx := len(m.PositiveSpan) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.PositiveSpan[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - } - if len(m.NegativeCount) > 0 { - for iNdEx := len(m.NegativeCount) - 1; iNdEx >= 0; iNdEx-- { - f5 := math.Float64bits(float64(m.NegativeCount[iNdEx])) - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(f5)) - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.NegativeCount)*8)) - i-- - dAtA[i] = 0x5a - } - if len(m.NegativeDelta) > 0 { - var pksize7 int - for _, num := range m.NegativeDelta { - pksize7 += protohelpers.SizeOfZigzag(uint64(num)) - } - i -= pksize7 - j6 := i - for _, num := range m.NegativeDelta { - x8 := (uint64(num) << 1) ^ uint64((num >> 63)) - for x8 >= 1<<7 { - dAtA[j6] = uint8(uint64(x8)&0x7f | 0x80) - j6++ - x8 >>= 7 - } - dAtA[j6] = uint8(x8) - j6++ - } - i = protohelpers.EncodeVarint(dAtA, i, uint64(pksize7)) - i-- - dAtA[i] = 0x52 - } - if len(m.NegativeSpan) > 0 { - for iNdEx := len(m.NegativeSpan) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.NegativeSpan[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x4a - } - } - if m.ZeroCountFloat != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.ZeroCountFloat)))) - i-- - dAtA[i] = 0x41 - } - if m.ZeroCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ZeroCount)) - i-- - dAtA[i] = 0x38 - } - if m.ZeroThreshold != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.ZeroThreshold)))) - i-- - dAtA[i] = 0x31 - } - if m.Schema != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64((uint32(m.Schema)<<1)^uint32((m.Schema>>31)))) - i-- - dAtA[i] = 0x28 - } - if m.SampleCountFloat != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SampleCountFloat)))) - i-- - dAtA[i] = 0x21 - } - if len(m.Bucket) > 0 { - for iNdEx := len(m.Bucket) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Bucket[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.SampleSum != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.SampleSum)))) - i-- - dAtA[i] = 0x11 - } - if m.SampleCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.SampleCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Bucket) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Bucket) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Bucket) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.CumulativeCountFloat != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.CumulativeCountFloat)))) - i-- - dAtA[i] = 0x21 - } - if m.Exemplar != nil { - size, err := m.Exemplar.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.UpperBound != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.UpperBound)))) - i-- - dAtA[i] = 0x11 - } - if m.CumulativeCount != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.CumulativeCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BucketSpan) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BucketSpan) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *BucketSpan) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Length != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x10 - } - if m.Offset != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64((uint32(m.Offset)<<1)^uint32((m.Offset>>31)))) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Exemplar) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Exemplar) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Exemplar) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Timestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.Timestamp).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Value != 0 { - i -= 8 - binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) - i-- - dAtA[i] = 0x11 - } - if len(m.Label) > 0 { - for iNdEx := len(m.Label) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Label[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Metric) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Metric) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Metric) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Histogram != nil { - size, err := m.Histogram.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if m.TimestampMs != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TimestampMs)) - i-- - dAtA[i] = 0x30 - } - if m.Untyped != nil { - size, err := m.Untyped.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if m.Summary != nil { - size, err := m.Summary.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if m.Counter != nil { - size, err := m.Counter.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.Gauge != nil { - size, err := m.Gauge.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if len(m.Label) > 0 { - for iNdEx := len(m.Label) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Label[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MetricFamily) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricFamily) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *MetricFamily) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Unit) > 0 { - i -= len(m.Unit) - copy(dAtA[i:], m.Unit) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Unit))) - i-- - dAtA[i] = 0x2a - } - if len(m.Metric) > 0 { - for iNdEx := len(m.Metric) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Metric[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if m.Type != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x18 - } - if len(m.Help) > 0 { - i -= len(m.Help) - copy(dAtA[i:], m.Help) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Help))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LabelPair) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Gauge) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != 0 { - n += 9 - } - n += len(m.unknownFields) - return n -} - -func (m *Counter) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != 0 { - n += 9 - } - if m.Exemplar != nil { - l = m.Exemplar.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.CreatedTimestamp != nil { - l = (*timestamppb1.Timestamp)(m.CreatedTimestamp).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Quantile) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Quantile != 0 { - n += 9 - } - if m.Value != 0 { - n += 9 - } - n += len(m.unknownFields) - return n -} - -func (m *Summary) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SampleCount != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.SampleCount)) - } - if m.SampleSum != 0 { - n += 9 - } - if len(m.Quantile) > 0 { - for _, e := range m.Quantile { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.CreatedTimestamp != nil { - l = (*timestamppb1.Timestamp)(m.CreatedTimestamp).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Untyped) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != 0 { - n += 9 - } - n += len(m.unknownFields) - return n -} - -func (m *Histogram) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SampleCount != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.SampleCount)) - } - if m.SampleSum != 0 { - n += 9 - } - if len(m.Bucket) > 0 { - for _, e := range m.Bucket { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.SampleCountFloat != 0 { - n += 9 - } - if m.Schema != 0 { - n += 1 + protohelpers.SizeOfZigzag(uint64(m.Schema)) - } - if m.ZeroThreshold != 0 { - n += 9 - } - if m.ZeroCount != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ZeroCount)) - } - if m.ZeroCountFloat != 0 { - n += 9 - } - if len(m.NegativeSpan) > 0 { - for _, e := range m.NegativeSpan { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.NegativeDelta) > 0 { - l = 0 - for _, e := range m.NegativeDelta { - l += protohelpers.SizeOfZigzag(uint64(e)) - } - n += 1 + protohelpers.SizeOfVarint(uint64(l)) + l - } - if len(m.NegativeCount) > 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(len(m.NegativeCount)*8)) + len(m.NegativeCount)*8 - } - if len(m.PositiveSpan) > 0 { - for _, e := range m.PositiveSpan { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.PositiveDelta) > 0 { - l = 0 - for _, e := range m.PositiveDelta { - l += protohelpers.SizeOfZigzag(uint64(e)) - } - n += 1 + protohelpers.SizeOfVarint(uint64(l)) + l - } - if len(m.PositiveCount) > 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(len(m.PositiveCount)*8)) + len(m.PositiveCount)*8 - } - if m.CreatedTimestamp != nil { - l = (*timestamppb1.Timestamp)(m.CreatedTimestamp).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Exemplars) > 0 { - for _, e := range m.Exemplars { - l = e.SizeVT() - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Bucket) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CumulativeCount != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.CumulativeCount)) - } - if m.UpperBound != 0 { - n += 9 - } - if m.Exemplar != nil { - l = m.Exemplar.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.CumulativeCountFloat != 0 { - n += 9 - } - n += len(m.unknownFields) - return n -} - -func (m *BucketSpan) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Offset != 0 { - n += 1 + protohelpers.SizeOfZigzag(uint64(m.Offset)) - } - if m.Length != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Length)) - } - n += len(m.unknownFields) - return n -} - -func (m *Exemplar) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Label) > 0 { - for _, e := range m.Label { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.Value != 0 { - n += 9 - } - if m.Timestamp != nil { - l = (*timestamppb1.Timestamp)(m.Timestamp).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Metric) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Label) > 0 { - for _, e := range m.Label { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.Gauge != nil { - l = m.Gauge.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Counter != nil { - l = m.Counter.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Summary != nil { - l = m.Summary.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Untyped != nil { - l = m.Untyped.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TimestampMs != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TimestampMs)) - } - if m.Histogram != nil { - l = m.Histogram.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *MetricFamily) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Help) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Type != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Type)) - } - if len(m.Metric) > 0 { - for _, e := range m.Metric { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - l = len(m.Unit) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *LabelPair) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LabelPair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LabelPair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Gauge) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Gauge: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Gauge: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Counter) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Counter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Counter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exemplar", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Exemplar == nil { - m.Exemplar = &Exemplar{} - } - if err := m.Exemplar.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CreatedTimestamp == nil { - m.CreatedTimestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Quantile) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Quantile: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Quantile: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Quantile", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Quantile = float64(math.Float64frombits(v)) - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Summary) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Summary: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Summary: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleCount", wireType) - } - m.SampleCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SampleCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleSum", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.SampleSum = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quantile", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Quantile = append(m.Quantile, &Quantile{}) - if err := m.Quantile[len(m.Quantile)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CreatedTimestamp == nil { - m.CreatedTimestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Untyped) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Untyped: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Untyped: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Histogram) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Histogram: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Histogram: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleCount", wireType) - } - m.SampleCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SampleCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleSum", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.SampleSum = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bucket", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bucket = append(m.Bucket, &Bucket{}) - if err := m.Bucket[len(m.Bucket)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleCountFloat", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.SampleCountFloat = float64(math.Float64frombits(v)) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.Schema = v - case 6: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field ZeroThreshold", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.ZeroThreshold = float64(math.Float64frombits(v)) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ZeroCount", wireType) - } - m.ZeroCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ZeroCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field ZeroCountFloat", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.ZeroCountFloat = float64(math.Float64frombits(v)) - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NegativeSpan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NegativeSpan = append(m.NegativeSpan, &BucketSpan{}) - if err := m.NegativeSpan[len(m.NegativeSpan)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.NegativeDelta = append(m.NegativeDelta, int64(v)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.NegativeDelta) == 0 { - m.NegativeDelta = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.NegativeDelta = append(m.NegativeDelta, int64(v)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field NegativeDelta", wireType) - } - case 11: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.NegativeCount = append(m.NegativeCount, v2) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen / 8 - if elementCount != 0 && len(m.NegativeCount) == 0 { - m.NegativeCount = make([]float64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.NegativeCount = append(m.NegativeCount, v2) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field NegativeCount", wireType) - } - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PositiveSpan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PositiveSpan = append(m.PositiveSpan, &BucketSpan{}) - if err := m.PositiveSpan[len(m.PositiveSpan)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PositiveDelta = append(m.PositiveDelta, int64(v)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.PositiveDelta) == 0 { - m.PositiveDelta = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PositiveDelta = append(m.PositiveDelta, int64(v)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PositiveDelta", wireType) - } - case 14: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.PositiveCount = append(m.PositiveCount, v2) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen / 8 - if elementCount != 0 && len(m.PositiveCount) == 0 { - m.PositiveCount = make([]float64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.PositiveCount = append(m.PositiveCount, v2) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PositiveCount", wireType) - } - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CreatedTimestamp == nil { - m.CreatedTimestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exemplars", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Exemplars = append(m.Exemplars, &Exemplar{}) - if err := m.Exemplars[len(m.Exemplars)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Bucket) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Bucket: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Bucket: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CumulativeCount", wireType) - } - m.CumulativeCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CumulativeCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field UpperBound", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.UpperBound = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exemplar", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Exemplar == nil { - m.Exemplar = &Exemplar{} - } - if err := m.Exemplar.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field CumulativeCountFloat", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.CumulativeCountFloat = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BucketSpan) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BucketSpan: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BucketSpan: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.Offset = v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Exemplar) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Exemplar: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Exemplar: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = append(m.Label, &LabelPair{}) - if err := m.Label[len(m.Label)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Timestamp == nil { - m.Timestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.Timestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Metric) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Metric: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Metric: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = append(m.Label, &LabelPair{}) - if err := m.Label[len(m.Label)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gauge", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Gauge == nil { - m.Gauge = &Gauge{} - } - if err := m.Gauge.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Counter", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Counter == nil { - m.Counter = &Counter{} - } - if err := m.Counter.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Summary == nil { - m.Summary = &Summary{} - } - if err := m.Summary.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Untyped", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Untyped == nil { - m.Untyped = &Untyped{} - } - if err := m.Untyped.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimestampMs", wireType) - } - m.TimestampMs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimestampMs |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Histogram", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Histogram == nil { - m.Histogram = &Histogram{} - } - if err := m.Histogram.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricFamily) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricFamily: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricFamily: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Help", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Help = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= MetricType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metric = append(m.Metric, &Metric{}) - if err := m.Metric[len(m.Metric)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Unit = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LabelPair) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LabelPair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LabelPair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var stringValue string - if intStringLen > 0 { - stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) - } - m.Name = stringValue - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var stringValue string - if intStringLen > 0 { - stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) - } - m.Value = stringValue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Gauge) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Gauge: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Gauge: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Counter) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Counter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Counter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exemplar", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Exemplar == nil { - m.Exemplar = &Exemplar{} - } - if err := m.Exemplar.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CreatedTimestamp == nil { - m.CreatedTimestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Quantile) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Quantile: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Quantile: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Quantile", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Quantile = float64(math.Float64frombits(v)) - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Summary) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Summary: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Summary: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleCount", wireType) - } - m.SampleCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SampleCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleSum", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.SampleSum = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quantile", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Quantile = append(m.Quantile, &Quantile{}) - if err := m.Quantile[len(m.Quantile)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CreatedTimestamp == nil { - m.CreatedTimestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Untyped) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Untyped: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Untyped: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Histogram) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Histogram: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Histogram: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleCount", wireType) - } - m.SampleCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SampleCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleSum", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.SampleSum = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bucket", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bucket = append(m.Bucket, &Bucket{}) - if err := m.Bucket[len(m.Bucket)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SampleCountFloat", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.SampleCountFloat = float64(math.Float64frombits(v)) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.Schema = v - case 6: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field ZeroThreshold", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.ZeroThreshold = float64(math.Float64frombits(v)) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ZeroCount", wireType) - } - m.ZeroCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ZeroCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field ZeroCountFloat", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.ZeroCountFloat = float64(math.Float64frombits(v)) - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NegativeSpan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NegativeSpan = append(m.NegativeSpan, &BucketSpan{}) - if err := m.NegativeSpan[len(m.NegativeSpan)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.NegativeDelta = append(m.NegativeDelta, int64(v)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.NegativeDelta) == 0 { - m.NegativeDelta = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.NegativeDelta = append(m.NegativeDelta, int64(v)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field NegativeDelta", wireType) - } - case 11: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.NegativeCount = append(m.NegativeCount, v2) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen / 8 - if elementCount != 0 && len(m.NegativeCount) == 0 { - m.NegativeCount = make([]float64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.NegativeCount = append(m.NegativeCount, v2) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field NegativeCount", wireType) - } - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PositiveSpan", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PositiveSpan = append(m.PositiveSpan, &BucketSpan{}) - if err := m.PositiveSpan[len(m.PositiveSpan)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PositiveDelta = append(m.PositiveDelta, int64(v)) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.PositiveDelta) == 0 { - m.PositiveDelta = make([]int64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.PositiveDelta = append(m.PositiveDelta, int64(v)) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PositiveDelta", wireType) - } - case 14: - if wireType == 1 { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.PositiveCount = append(m.PositiveCount, v2) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - elementCount = packedLen / 8 - if elementCount != 0 && len(m.PositiveCount) == 0 { - m.PositiveCount = make([]float64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - v2 := float64(math.Float64frombits(v)) - m.PositiveCount = append(m.PositiveCount, v2) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field PositiveCount", wireType) - } - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatedTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CreatedTimestamp == nil { - m.CreatedTimestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.CreatedTimestamp).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exemplars", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Exemplars = append(m.Exemplars, &Exemplar{}) - if err := m.Exemplars[len(m.Exemplars)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Bucket) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Bucket: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Bucket: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CumulativeCount", wireType) - } - m.CumulativeCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CumulativeCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field UpperBound", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.UpperBound = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exemplar", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Exemplar == nil { - m.Exemplar = &Exemplar{} - } - if err := m.Exemplar.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field CumulativeCountFloat", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.CumulativeCountFloat = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BucketSpan) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BucketSpan: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BucketSpan: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) - m.Offset = v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Exemplar) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Exemplar: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Exemplar: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = append(m.Label, &LabelPair{}) - if err := m.Label[len(m.Label)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Value = float64(math.Float64frombits(v)) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Timestamp == nil { - m.Timestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.Timestamp).UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Metric) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Metric: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Metric: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = append(m.Label, &LabelPair{}) - if err := m.Label[len(m.Label)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gauge", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Gauge == nil { - m.Gauge = &Gauge{} - } - if err := m.Gauge.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Counter", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Counter == nil { - m.Counter = &Counter{} - } - if err := m.Counter.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Summary == nil { - m.Summary = &Summary{} - } - if err := m.Summary.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Untyped", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Untyped == nil { - m.Untyped = &Untyped{} - } - if err := m.Untyped.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimestampMs", wireType) - } - m.TimestampMs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimestampMs |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Histogram", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Histogram == nil { - m.Histogram = &Histogram{} - } - if err := m.Histogram.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricFamily) UnmarshalVTUnsafe(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricFamily: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricFamily: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var stringValue string - if intStringLen > 0 { - stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) - } - m.Name = stringValue - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Help", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var stringValue string - if intStringLen > 0 { - stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) - } - m.Help = stringValue - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= MetricType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metric = append(m.Metric, &Metric{}) - if err := m.Metric[len(m.Metric)-1].UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var stringValue string - if intStringLen > 0 { - stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) - } - m.Unit = stringValue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/prompb/io/prometheus/write/v2/custom.go b/prompb/io/prometheus/write/v2/custom.go deleted file mode 100644 index 0b09ee590d..0000000000 --- a/prompb/io/prometheus/write/v2/custom.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2024 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package writev2 - -import ( - math_bits "math/bits" - "slices" -) - -func (m Sample) T() int64 { return m.Timestamp } -func (m Sample) V() float64 { return m.Value } - -func (m *Request) OptimizedMarshal(dst []byte) ([]byte, error) { - siz := m.SizeVT() - if cap(dst) < siz { - dst = make([]byte, siz) - } - n, err := m.OptimizedMarshalToSizedBuffer(dst[:siz]) - if err != nil { - return nil, err - } - return dst[:n], nil -} - -// OptimizedMarshalToSizedBuffer is mostly a copy of the generated MarshalToSizedBuffer, -// but calls OptimizedMarshalToSizedBuffer on the timeseries. -func (m *Request) OptimizedMarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - // Removed XXX_unrecognized handling - if len(m.Timeseries) > 0 { - for iNdEx := len(m.Timeseries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Timeseries[iNdEx].OptimizedMarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Symbols) > 0 { - for iNdEx := len(m.Symbols) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Symbols[iNdEx]) - copy(dAtA[i:], m.Symbols[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Symbols[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - return len(dAtA) - i, nil -} - -// OptimizedMarshalToSizedBuffer is mostly a copy of the generated MarshalToSizedBuffer, -// but marshals m.LabelsRefs in place without extra allocations. -func (m *TimeSeries) OptimizedMarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CreatedTimestamp != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.CreatedTimestamp)) - i-- - dAtA[i] = 0x30 - } - { - size, err := m.Metadata.MarshalToVT(dAtA[:i]) // Adjusted for vtproto - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.Histograms) > 0 { - for iNdEx := len(m.Histograms) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Histograms[iNdEx].MarshalToVT(dAtA[:i]) // Adjusted for vtproto - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Exemplars) > 0 { - for iNdEx := len(m.Exemplars) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Exemplars[iNdEx].MarshalToVT(dAtA[:i]) // Adjusted for vtproto - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Samples) > 0 { - for iNdEx := len(m.Samples) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Samples[iNdEx].MarshalToVT(dAtA[:i]) // Adjusted for vtproto - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - - if len(m.LabelsRefs) > 0 { - var j10 int - start := i - for _, num := range m.LabelsRefs { - for num >= 1<<7 { - dAtA[i-1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - i-- - j10++ - } - dAtA[i-1] = uint8(num) - i-- - j10++ - } - slices.Reverse(dAtA[i:start]) - i = encodeVarintTypes(dAtA, i, uint64(j10)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} diff --git a/prompb/io/prometheus/write/v2/custom_test.go b/prompb/io/prometheus/write/v2/custom_test.go deleted file mode 100644 index 139cbfb225..0000000000 --- a/prompb/io/prometheus/write/v2/custom_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2023 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package writev2 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestOptimizedMarshal(t *testing.T) { - for _, tt := range []struct { - name string - m *Request - }{ - { - name: "empty", - m: &Request{}, - }, - { - name: "simple", - m: &Request{ - Timeseries: []TimeSeries{ - { - LabelsRefs: []uint32{ - 0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11, - 12, 13, - 14, 15, - }, - - Samples: []Sample{{Value: 1, Timestamp: 0}}, - Exemplars: []Exemplar{{LabelsRefs: []uint32{0, 1}, Value: 1, Timestamp: 0}}, - Histograms: nil, - }, - { - LabelsRefs: []uint32{ - 0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11, - 12, 13, - 14, 15, - }, - Samples: []Sample{{Value: 2, Timestamp: 1}}, - Exemplars: []Exemplar{{LabelsRefs: []uint32{0, 1}, Value: 2, Timestamp: 1}}, - Histograms: nil, - }, - }, - Symbols: []string{ - "a", "b", - "c", "d", - "e", "f", - "g", "h", - "i", "j", - "k", "l", - "m", "n", - "o", "p", - }, - }, - }, - } { - t.Run(tt.name, func(t *testing.T) { - // Keep the slice allocated to mimic what std Marshal - // would give to sized Marshal. - got := make([]byte, 0) - - // Should be the same as the standard marshal. - expected, err := tt.m.Marshal() - require.NoError(t, err) - got, err = tt.m.OptimizedMarshal(got) - require.NoError(t, err) - require.Equal(t, expected, got) - - // Unmarshal should work too. - m := &Request{} - require.NoError(t, m.Unmarshal(got)) - require.Equal(t, tt.m, m) - }) - } -} diff --git a/prompb/io/prometheus/write/v2/types_test.go b/prompb/io/prometheus/write/v2/types_test.go index 5b7622fc2f..2497f3748d 100644 --- a/prompb/io/prometheus/write/v2/types_test.go +++ b/prompb/io/prometheus/write/v2/types_test.go @@ -17,8 +17,8 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/prompb" ) @@ -37,9 +37,9 @@ func TestInteropV2UnmarshalWithV1_DeterministicEmpty(t *testing.T) { { incoming: &Request{ Symbols: []string{"", "__name__", "metric1"}, - Timeseries: []TimeSeries{ + Timeseries: []*TimeSeries{ {LabelsRefs: []uint32{1, 2}}, - {Samples: []Sample{{Value: 21.4, Timestamp: time.Now().UnixMilli()}}}, + {Samples: []*Sample{{Value: 21.4, Timestamp: time.Now().UnixMilli()}}}, }, // NOTE: Without reserved fields, proto: illegal wireType 7 }, }, @@ -52,10 +52,6 @@ func TestInteropV2UnmarshalWithV1_DeterministicEmpty(t *testing.T) { out := &prompb.WriteRequest{} require.NoError(t, proto.Unmarshal(in, out)) - // Drop unknowns, we expect them when incoming payload had some fields. - // This field & method will be likely gone after gogo removal. - out.XXX_unrecognized = nil // NOTE: out.XXX_DiscardUnknown() does not work with nullables. - require.Equal(t, expectedV1Empty, out) }) } @@ -69,10 +65,10 @@ func TestInteropV1UnmarshalWithV2_DeterministicEmpty(t *testing.T) { }, { incoming: &prompb.WriteRequest{ - Timeseries: []prompb.TimeSeries{ + Timeseries: []*prompb.TimeSeries{ { - Labels: []prompb.Label{{Name: "__name__", Value: "metric1"}}, - Samples: []prompb.Sample{{Value: 21.4, Timestamp: time.Now().UnixMilli()}}, + Labels: []*prompb.Label{{Name: "__name__", Value: "metric1"}}, + Samples: []*prompb.Sample{{Value: 21.4, Timestamp: time.Now().UnixMilli()}}, }, }, }, @@ -87,10 +83,6 @@ func TestInteropV1UnmarshalWithV2_DeterministicEmpty(t *testing.T) { out := &Request{} require.NoError(t, proto.Unmarshal(in, out)) - // Drop unknowns, we expect them when incoming payload had some fields. - // This field & method will be likely gone after gogo removal. - out.XXX_unrecognized = nil // NOTE: out.XXX_DiscardUnknown() does not work with nullables. - require.Equal(t, expectedV2Empty, out) }) } diff --git a/prompb/rwcommon/codec_test.go b/prompb/rwcommon/codec_test.go index 2ab95e0d19..bafc9bdeec 100644 --- a/prompb/rwcommon/codec_test.go +++ b/prompb/rwcommon/codec_test.go @@ -30,7 +30,7 @@ func TestToLabels(t *testing.T) { expected := labels.FromStrings("__name__", "metric1", "foo", "bar") t.Run("v1", func(t *testing.T) { - ts := prompb.TimeSeries{Labels: []prompb.Label{{Name: "__name__", Value: "metric1"}, {Name: "foo", Value: "bar"}}} + ts := prompb.TimeSeries{Labels: []*prompb.Label{{Name: "__name__", Value: "metric1"}, {Name: "foo", Value: "bar"}}} b := labels.NewScratchBuilder(2) require.Equal(t, expected, ts.ToLabels(&b, nil)) require.Equal(t, ts.Labels, prompb.FromLabels(expected, nil)) @@ -86,41 +86,41 @@ func TestToMetadata(t *testing.T) { sym := writev2.NewSymbolTable() for _, tc := range []struct { - input writev2.Metadata - expected metadata.Metadata + input *writev2.Metadata + expected *metadata.Metadata }{ { - input: writev2.Metadata{}, - expected: metadata.Metadata{ + input: &writev2.Metadata{}, + expected: &metadata.Metadata{ Type: model.MetricTypeUnknown, }, }, { - input: writev2.Metadata{ + input: &writev2.Metadata{ Type: 12414, // Unknown. }, - expected: metadata.Metadata{ + expected: &metadata.Metadata{ Type: model.MetricTypeUnknown, }, }, { - input: writev2.Metadata{ + input: &writev2.Metadata{ Type: writev2.Metadata_METRIC_TYPE_COUNTER, HelpRef: sym.Symbolize("help1"), UnitRef: sym.Symbolize("unit1"), }, - expected: metadata.Metadata{ + expected: &metadata.Metadata{ Type: model.MetricTypeCounter, Help: "help1", Unit: "unit1", }, }, { - input: writev2.Metadata{ + input: &writev2.Metadata{ Type: writev2.Metadata_METRIC_TYPE_STATESET, HelpRef: sym.Symbolize("help2"), }, - expected: metadata.Metadata{ + expected: &metadata.Metadata{ Type: model.MetricTypeStateset, Help: "help2", }, diff --git a/scrape/clientprotobuf.go b/scrape/clientprotobuf.go index 2213268d59..583a0ee5ff 100644 --- a/scrape/clientprotobuf.go +++ b/scrape/clientprotobuf.go @@ -17,7 +17,7 @@ import ( "bytes" "encoding/binary" - "github.com/gogo/protobuf/proto" + "google.golang.org/protobuf/proto" // Intentionally using client model to simulate client in tests. dto "github.com/prometheus/client_model/go" diff --git a/scrape/helpers_test.go b/scrape/helpers_test.go index 116fa5c94b..f124e01a65 100644 --- a/scrape/helpers_test.go +++ b/scrape/helpers_test.go @@ -24,9 +24,9 @@ import ( "sync" "testing" - "github.com/gogo/protobuf/proto" dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/model/exemplar" "github.com/prometheus/prometheus/model/histogram" diff --git a/scrape/manager_test.go b/scrape/manager_test.go index c8d9bd6980..4c6f3becf8 100644 --- a/scrape/manager_test.go +++ b/scrape/manager_test.go @@ -26,11 +26,11 @@ import ( "time" "github.com/go-kit/log" - "github.com/gogo/protobuf/proto" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" "gopkg.in/yaml.v2" diff --git a/scrape/scrape_test.go b/scrape/scrape_test.go index a3fe6ac1a5..dfb3b05312 100644 --- a/scrape/scrape_test.go +++ b/scrape/scrape_test.go @@ -32,13 +32,13 @@ import ( "time" "github.com/go-kit/log" - "github.com/gogo/protobuf/proto" "github.com/google/go-cmp/cmp" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" config_util "github.com/prometheus/common/config" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/discovery" diff --git a/scripts/tools.go b/scripts/tools.go index e1dd80232f..67e6015378 100644 --- a/scripts/tools.go +++ b/scripts/tools.go @@ -18,7 +18,6 @@ package tools import ( - _ "github.com/gogo/protobuf/protoc-gen-gogofast" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" _ "golang.org/x/tools/cmd/goimports" diff --git a/storage/remote/chunked.go b/storage/remote/chunked.go index 96ce483e0c..ec00df839b 100644 --- a/storage/remote/chunked.go +++ b/storage/remote/chunked.go @@ -23,7 +23,7 @@ import ( "io" "net/http" - "github.com/gogo/protobuf/proto" + "google.golang.org/protobuf/proto" ) // DefaultChunkedReadLimit is the default value for the maximum size of the protobuf frame client allows. diff --git a/storage/remote/client.go b/storage/remote/client.go index 17caf7be9b..b856e9f2f9 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -23,7 +23,6 @@ import ( "strings" "time" - "github.com/gogo/protobuf/proto" "github.com/golang/snappy" "github.com/prometheus/client_golang/prometheus" config_util "github.com/prometheus/common/config" @@ -33,6 +32,7 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/prompb" diff --git a/storage/remote/codec.go b/storage/remote/codec.go index 8ee2daca3b..b1a12b6742 100644 --- a/storage/remote/codec.go +++ b/storage/remote/codec.go @@ -24,10 +24,10 @@ import ( "sort" "sync" - "github.com/gogo/protobuf/proto" "github.com/golang/snappy" "github.com/prometheus/common/model" "go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" diff --git a/storage/remote/codec_test.go b/storage/remote/codec_test.go index 279d10e41b..4b70a20acf 100644 --- a/storage/remote/codec_test.go +++ b/storage/remote/codec_test.go @@ -20,9 +20,9 @@ import ( "testing" "github.com/go-kit/log" - "github.com/gogo/protobuf/proto" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" @@ -50,30 +50,30 @@ var ( } writeRequestFixture = &prompb.WriteRequest{ - Timeseries: []prompb.TimeSeries{ + Timeseries: []*prompb.TimeSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar"}, }, - Samples: []prompb.Sample{{Value: 1, Timestamp: 1}}, - Exemplars: []prompb.Exemplar{{Labels: []prompb.Label{{Name: "f", Value: "g"}}, Value: 1, Timestamp: 1}}, - Histograms: []prompb.Histogram{prompb.FromIntHistogram(1, &testHistogram), prompb.FromFloatHistogram(2, testHistogram.ToFloat(nil))}, + Samples: []*prompb.Sample{{Value: 1, Timestamp: 1}}, + Exemplars: []*prompb.Exemplar{{Labels: []*prompb.Label{{Name: "f", Value: "g"}}, Value: 1, Timestamp: 1}}, + Histograms: []*prompb.Histogram{prompb.FromIntHistogram(1, &testHistogram), prompb.FromFloatHistogram(2, testHistogram.ToFloat(nil))}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar"}, }, - Samples: []prompb.Sample{{Value: 2, Timestamp: 2}}, - Exemplars: []prompb.Exemplar{{Labels: []prompb.Label{{Name: "h", Value: "i"}}, Value: 2, Timestamp: 2}}, - Histograms: []prompb.Histogram{prompb.FromIntHistogram(3, &testHistogram), prompb.FromFloatHistogram(4, testHistogram.ToFloat(nil))}, + Samples: []*prompb.Sample{{Value: 2, Timestamp: 2}}, + Exemplars: []*prompb.Exemplar{{Labels: []*prompb.Label{{Name: "h", Value: "i"}}, Value: 2, Timestamp: 2}}, + Histograms: []*prompb.Histogram{prompb.FromIntHistogram(3, &testHistogram), prompb.FromFloatHistogram(4, testHistogram.ToFloat(nil))}, }, }, } @@ -93,30 +93,30 @@ var ( // NOTE: Use TestWriteV2RequestFixture and copy the diff to regenerate if needed. writeV2RequestFixture = &writev2.Request{ Symbols: []string{"", "__name__", "test_metric1", "b", "c", "baz", "qux", "d", "e", "foo", "bar", "f", "g", "h", "i", "Test gauge for test purposes", "Maybe op/sec who knows (:", "Test counter for test purposes"}, - Timeseries: []writev2.TimeSeries{ + Timeseries: []*writev2.TimeSeries{ { LabelsRefs: []uint32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, // Symbolized writeRequestFixture.Timeseries[0].Labels - Metadata: writev2.Metadata{ + Metadata: &writev2.Metadata{ Type: writev2.Metadata_METRIC_TYPE_GAUGE, // writeV2RequestSeries1Metadata.Type. HelpRef: 15, // Symbolized writeV2RequestSeries1Metadata.Help. UnitRef: 16, // Symbolized writeV2RequestSeries1Metadata.Unit. }, - Samples: []writev2.Sample{{Value: 1, Timestamp: 1}}, - Exemplars: []writev2.Exemplar{{LabelsRefs: []uint32{11, 12}, Value: 1, Timestamp: 1}}, - Histograms: []writev2.Histogram{writev2.FromIntHistogram(1, &testHistogram), writev2.FromFloatHistogram(2, testHistogram.ToFloat(nil))}, + Samples: []*writev2.Sample{{Value: 1, Timestamp: 1}}, + Exemplars: []*writev2.Exemplar{{LabelsRefs: []uint32{11, 12}, Value: 1, Timestamp: 1}}, + Histograms: []*writev2.Histogram{writev2.FromIntHistogram(1, &testHistogram), writev2.FromFloatHistogram(2, testHistogram.ToFloat(nil))}, }, { LabelsRefs: []uint32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, // Same series as first. - Metadata: writev2.Metadata{ + Metadata: &writev2.Metadata{ Type: writev2.Metadata_METRIC_TYPE_COUNTER, // writeV2RequestSeries2Metadata.Type. HelpRef: 17, // Symbolized writeV2RequestSeries2Metadata.Help. // No unit. }, - Samples: []writev2.Sample{{Value: 2, Timestamp: 2}}, - Exemplars: []writev2.Exemplar{{LabelsRefs: []uint32{13, 14}, Value: 2, Timestamp: 2}}, - Histograms: []writev2.Histogram{writev2.FromIntHistogram(3, &testHistogram), writev2.FromFloatHistogram(4, testHistogram.ToFloat(nil))}, + Samples: []*writev2.Sample{{Value: 2, Timestamp: 2}}, + Exemplars: []*writev2.Exemplar{{LabelsRefs: []uint32{13, 14}, Value: 2, Timestamp: 2}}, + Histograms: []*writev2.Histogram{writev2.FromIntHistogram(3, &testHistogram), writev2.FromFloatHistogram(4, testHistogram.ToFloat(nil))}, }, }, } @@ -130,28 +130,28 @@ func TestWriteV2RequestFixture(t *testing.T) { exemplar1LabelRefs := st.SymbolizeLabels(writeRequestFixture.Timeseries[0].Exemplars[0].ToExemplar(&b, nil).Labels, nil) exemplar2LabelRefs := st.SymbolizeLabels(writeRequestFixture.Timeseries[1].Exemplars[0].ToExemplar(&b, nil).Labels, nil) expected := &writev2.Request{ - Timeseries: []writev2.TimeSeries{ + Timeseries: []*writev2.TimeSeries{ { LabelsRefs: labelRefs, - Metadata: writev2.Metadata{ + Metadata: &writev2.Metadata{ Type: writev2.Metadata_METRIC_TYPE_GAUGE, HelpRef: st.Symbolize(writeV2RequestSeries1Metadata.Help), UnitRef: st.Symbolize(writeV2RequestSeries1Metadata.Unit), }, - Samples: []writev2.Sample{{Value: 1, Timestamp: 1}}, - Exemplars: []writev2.Exemplar{{LabelsRefs: exemplar1LabelRefs, Value: 1, Timestamp: 1}}, - Histograms: []writev2.Histogram{writev2.FromIntHistogram(1, &testHistogram), writev2.FromFloatHistogram(2, testHistogram.ToFloat(nil))}, + Samples: []*writev2.Sample{{Value: 1, Timestamp: 1}}, + Exemplars: []*writev2.Exemplar{{LabelsRefs: exemplar1LabelRefs, Value: 1, Timestamp: 1}}, + Histograms: []*writev2.Histogram{writev2.FromIntHistogram(1, &testHistogram), writev2.FromFloatHistogram(2, testHistogram.ToFloat(nil))}, }, { LabelsRefs: labelRefs, - Metadata: writev2.Metadata{ + Metadata: &writev2.Metadata{ Type: writev2.Metadata_METRIC_TYPE_COUNTER, HelpRef: st.Symbolize(writeV2RequestSeries2Metadata.Help), // No unit. }, - Samples: []writev2.Sample{{Value: 2, Timestamp: 2}}, - Exemplars: []writev2.Exemplar{{LabelsRefs: exemplar2LabelRefs, Value: 2, Timestamp: 2}}, - Histograms: []writev2.Histogram{writev2.FromIntHistogram(3, &testHistogram), writev2.FromFloatHistogram(4, testHistogram.ToFloat(nil))}, + Samples: []*writev2.Sample{{Value: 2, Timestamp: 2}}, + Exemplars: []*writev2.Exemplar{{LabelsRefs: exemplar2LabelRefs, Value: 2, Timestamp: 2}}, + Histograms: []*writev2.Histogram{writev2.FromIntHistogram(3, &testHistogram), writev2.FromFloatHistogram(4, testHistogram.ToFloat(nil))}, }, }, Symbols: st.Symbols(), @@ -162,12 +162,12 @@ func TestWriteV2RequestFixture(t *testing.T) { func TestValidateLabelsAndMetricName(t *testing.T) { tests := []struct { - input []prompb.Label + input []*prompb.Label expectedErr string description string }{ { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name"}, {Name: "labelName", Value: "labelValue"}, }, @@ -175,7 +175,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "regular labels", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name"}, {Name: "_labelName", Value: "labelValue"}, }, @@ -183,7 +183,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "label name with _", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name"}, {Name: "@labelName", Value: "labelValue"}, }, @@ -191,7 +191,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "label name with @", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name"}, {Name: "123labelName", Value: "labelValue"}, }, @@ -199,7 +199,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "label name starts with numbers", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name"}, {Name: "", Value: "labelValue"}, }, @@ -207,7 +207,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "label name is empty string", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name"}, {Name: "labelName", Value: string([]byte{0xff})}, }, @@ -215,14 +215,14 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "label value is an invalid UTF-8 value", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "@invalid_name"}, }, expectedErr: "invalid metric name: @invalid_name", description: "metric name starts with @", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "__name__", Value: "name1"}, {Name: "__name__", Value: "name2"}, }, @@ -230,7 +230,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "duplicate label names", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "label1", Value: "name"}, {Name: "label2", Value: "name"}, }, @@ -238,7 +238,7 @@ func TestValidateLabelsAndMetricName(t *testing.T) { description: "duplicate label values", }, { - input: []prompb.Label{ + input: []*prompb.Label{ {Name: "", Value: "name"}, {Name: "label2", Value: "name"}, }, @@ -263,11 +263,11 @@ func TestValidateLabelsAndMetricName(t *testing.T) { func TestConcreteSeriesSet(t *testing.T) { series1 := &concreteSeries{ labels: labels.FromStrings("foo", "bar"), - floats: []prompb.Sample{{Value: 1, Timestamp: 2}}, + floats: []*prompb.Sample{{Value: 1, Timestamp: 2}}, } series2 := &concreteSeries{ labels: labels.FromStrings("foo", "baz"), - floats: []prompb.Sample{{Value: 3, Timestamp: 4}}, + floats: []*prompb.Sample{{Value: 3, Timestamp: 4}}, } c := &concreteSeriesSet{ series: []storage.Series{series1, series2}, @@ -297,7 +297,7 @@ func TestConcreteSeriesClonesLabels(t *testing.T) { func TestConcreteSeriesIterator_FloatSamples(t *testing.T) { series := &concreteSeries{ labels: labels.FromStrings("foo", "bar"), - floats: []prompb.Sample{ + floats: []*prompb.Sample{ {Value: 1, Timestamp: 1}, {Value: 1.5, Timestamp: 1}, {Value: 2, Timestamp: 2}, @@ -345,7 +345,7 @@ func TestConcreteSeriesIterator_FloatSamples(t *testing.T) { func TestConcreteSeriesIterator_HistogramSamples(t *testing.T) { histograms := tsdbutil.GenerateTestHistograms(5) - histProtos := make([]prompb.Histogram, len(histograms)) + histProtos := make([]*prompb.Histogram, len(histograms)) for i, h := range histograms { // Results in ts sequence of 1, 1, 2, 3, 4. var ts int64 @@ -402,7 +402,7 @@ func TestConcreteSeriesIterator_FloatAndHistogramSamples(t *testing.T) { // Series starts as histograms, then transitions to floats at ts=8 (with an overlap from ts=8 to ts=10), then // transitions back to histograms at ts=16. histograms := tsdbutil.GenerateTestHistograms(15) - histProtos := make([]prompb.Histogram, len(histograms)) + histProtos := make([]*prompb.Histogram, len(histograms)) for i, h := range histograms { if i < 10 { histProtos[i] = prompb.FromIntHistogram(int64(i+1), h) @@ -412,7 +412,7 @@ func TestConcreteSeriesIterator_FloatAndHistogramSamples(t *testing.T) { } series := &concreteSeries{ labels: labels.FromStrings("foo", "bar"), - floats: []prompb.Sample{ + floats: []*prompb.Sample{ {Value: 1, Timestamp: 8}, {Value: 2, Timestamp: 9}, {Value: 3, Timestamp: 10}, @@ -504,11 +504,11 @@ func TestConcreteSeriesIterator_FloatAndHistogramSamples(t *testing.T) { func TestFromQueryResultWithDuplicates(t *testing.T) { ts1 := prompb.TimeSeries{ - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "foo", Value: "bar"}, {Name: "foo", Value: "def"}, }, - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ {Value: 0.0, Timestamp: 0}, }, } @@ -554,17 +554,17 @@ func TestNegotiateResponseType(t *testing.T) { func TestMergeLabels(t *testing.T) { for _, tc := range []struct { - primary, secondary, expected []prompb.Label + primary, secondary, expected []*prompb.Label }{ { - primary: []prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "foo"}, {Name: "ddd", Value: "foo"}}, - secondary: []prompb.Label{{Name: "bbb", Value: "bar"}, {Name: "ccc", Value: "bar"}}, - expected: []prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "foo"}, {Name: "ccc", Value: "bar"}, {Name: "ddd", Value: "foo"}}, + primary: []*prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "foo"}, {Name: "ddd", Value: "foo"}}, + secondary: []*prompb.Label{{Name: "bbb", Value: "bar"}, {Name: "ccc", Value: "bar"}}, + expected: []*prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "foo"}, {Name: "ccc", Value: "bar"}, {Name: "ddd", Value: "foo"}}, }, { - primary: []prompb.Label{{Name: "bbb", Value: "bar"}, {Name: "ccc", Value: "bar"}}, - secondary: []prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "foo"}, {Name: "ddd", Value: "foo"}}, - expected: []prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "bar"}, {Name: "ccc", Value: "bar"}, {Name: "ddd", Value: "foo"}}, + primary: []*prompb.Label{{Name: "bbb", Value: "bar"}, {Name: "ccc", Value: "bar"}}, + secondary: []*prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "foo"}, {Name: "ddd", Value: "foo"}}, + expected: []*prompb.Label{{Name: "aaa", Value: "foo"}, {Name: "bbb", Value: "bar"}, {Name: "ccc", Value: "bar"}, {Name: "ddd", Value: "foo"}}, }, } { require.Equal(t, tc.expected, MergeLabels(tc.primary, tc.secondary)) @@ -592,21 +592,21 @@ func TestDecodeWriteV2Request(t *testing.T) { func TestStreamResponse(t *testing.T) { lbs1 := prompb.FromLabels(labels.FromStrings("instance", "localhost1", "job", "demo1"), nil) lbs2 := prompb.FromLabels(labels.FromStrings("instance", "localhost2", "job", "demo2"), nil) - chunk := prompb.Chunk{ + chunk := &prompb.Chunk{ Type: prompb.Chunk_XOR, Data: make([]byte, 100), } - lbSize, chunkSize := 0, chunk.Size() + lbSize, chunkSize := 0, chunk.SizeVT() for _, lb := range lbs1 { - lbSize += lb.Size() + lbSize += lb.SizeVT() } maxBytesInFrame := lbSize + chunkSize*2 testData := []*prompb.ChunkedSeries{{ Labels: lbs1, - Chunks: []prompb.Chunk{chunk, chunk, chunk, chunk}, + Chunks: []*prompb.Chunk{chunk, chunk, chunk, chunk}, }, { Labels: lbs2, - Chunks: []prompb.Chunk{chunk, chunk, chunk, chunk}, + Chunks: []*prompb.Chunk{chunk, chunk, chunk, chunk}, }} css := newMockChunkSeriesSet(testData) writer := mockWriter{} @@ -619,16 +619,16 @@ func TestStreamResponse(t *testing.T) { require.NoError(t, err) expectData := []*prompb.ChunkedSeries{{ Labels: lbs1, - Chunks: []prompb.Chunk{chunk, chunk}, + Chunks: []*prompb.Chunk{chunk, chunk}, }, { Labels: lbs1, - Chunks: []prompb.Chunk{chunk, chunk}, + Chunks: []*prompb.Chunk{chunk, chunk}, }, { Labels: lbs2, - Chunks: []prompb.Chunk{chunk, chunk}, + Chunks: []*prompb.Chunk{chunk, chunk}, }, { Labels: lbs2, - Chunks: []prompb.Chunk{chunk, chunk}, + Chunks: []*prompb.Chunk{chunk, chunk}, }} require.Equal(t, expectData, writer.actual) } @@ -680,7 +680,7 @@ func (c *mockChunkSeriesSet) Err() error { } type mockChunkIterator struct { - chunks []prompb.Chunk + chunks []*prompb.Chunk index int } diff --git a/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go b/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go index c4dd781ae6..88036238dd 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go @@ -13,9 +13,10 @@ package prometheusremotewrite import ( + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "testing" - "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/pdata/pcommon" "github.com/prometheus/prometheus/prompb" @@ -155,7 +156,9 @@ func TestCreateAttributes(t *testing.T) { } lbls := createAttributes(resource, attrs, settings, nil, false) - assert.ElementsMatch(t, lbls, tc.expectedLabels) + for i := range lbls { + require.True(t, proto.Equal(lbls[i], &tc.expectedLabels[i])) + } }) } } diff --git a/storage/remote/queue_manager.go b/storage/remote/queue_manager.go index c024866691..33f2901b47 100644 --- a/storage/remote/queue_manager.go +++ b/storage/remote/queue_manager.go @@ -24,7 +24,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/golang/snappy" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" @@ -1537,6 +1537,7 @@ func (s *shards) runShard(ctx context.Context, shardID int, queue *queue) { batchQueue := queue.Chan() pendingData := make([]*prompb.TimeSeries, max) for i := range pendingData { + pendingData[i] = &prompb.TimeSeries{} pendingData[i].Samples = []*prompb.Sample{{}} if s.qm.sendExemplars { pendingData[i].Exemplars = []*prompb.Exemplar{{}} @@ -1544,6 +1545,7 @@ func (s *shards) runShard(ctx context.Context, shardID int, queue *queue) { } pendingDataV2 := make([]*writev2.TimeSeries, max) for i := range pendingDataV2 { + pendingDataV2[i] = &writev2.TimeSeries{} pendingDataV2[i].Samples = []*writev2.Sample{{}} } @@ -1945,6 +1947,7 @@ func populateV2TimeSeries(symbolTable *writev2.SymbolsTable, batch []timeSeries, pendingData[nPending].Samples = pendingData[nPending].Samples[:0] // todo: should we also safeguard against empty metadata here? if d.metadata != nil { + pendingData[nPending].Metadata = &writev2.Metadata{} pendingData[nPending].Metadata.Type = writev2.FromMetadataType(d.metadata.Type) pendingData[nPending].Metadata.HelpRef = symbolTable.Symbolize(d.metadata.Help) pendingData[nPending].Metadata.HelpRef = symbolTable.Symbolize(d.metadata.Unit) @@ -2201,7 +2204,7 @@ func buildV2WriteRequest(logger log.Logger, samples []*writev2.TimeSeries, label pBuf = &[]byte{} // For convenience in tests. Not efficient. } - data, err := req.OptimizedMarshal(*pBuf) + data, err := req.MarshalVT() if err != nil { return nil, highest, lowest, err } diff --git a/storage/remote/queue_manager_test.go b/storage/remote/queue_manager_test.go index 7343184fc0..67de489003 100644 --- a/storage/remote/queue_manager_test.go +++ b/storage/remote/queue_manager_test.go @@ -29,7 +29,7 @@ import ( "time" "github.com/go-kit/log" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/golang/snappy" "github.com/google/go-cmp/cmp" "github.com/prometheus/client_golang/prometheus" @@ -803,7 +803,7 @@ func TestDisableReshardOnRetry(t *testing.T) { }, time.Minute, retryAfter, "shouldReshard should have been re-enabled") } -func createTimeseries(numSamples, numSeries int, extraLabels ...labels.Label) ([]record.RefSample, []record.RefSeries) { +func createTimeseries(numSamples, numSeries int, extraLabels ...*labels.Label) ([]record.RefSample, []record.RefSeries) { samples := make([]record.RefSample, 0, numSamples) series := make([]record.RefSeries, 0, numSeries) lb := labels.NewScratchBuilder(1 + len(extraLabels)) @@ -834,16 +834,16 @@ func createTimeseries(numSamples, numSeries int, extraLabels ...labels.Label) ([ return samples, series } -func createProtoTimeseriesWithOld(numSamples, baseTs int64, extraLabels ...labels.Label) []prompb.TimeSeries { - samples := make([]prompb.TimeSeries, numSamples) +func createProtoTimeseriesWithOld(numSamples, baseTs int64, extraLabels ...*labels.Label) []*prompb.TimeSeries { + samples := make([]*prompb.TimeSeries, numSamples) // use a fixed rand source so tests are consistent r := rand.New(rand.NewSource(99)) for j := int64(0); j < numSamples; j++ { name := fmt.Sprintf("test_metric_%d", j) - samples[j] = prompb.TimeSeries{ - Labels: []prompb.Label{{Name: "__name__", Value: name}}, - Samples: []prompb.Sample{ + samples[j] = &prompb.TimeSeries{ + Labels: []*prompb.Label{{Name: "__name__", Value: name}}, + Samples: []*prompb.Sample{ { Timestamp: baseTs + j, Value: float64(j), @@ -947,15 +947,15 @@ func getSeriesIDFromRef(r record.RefSeries) string { // TestWriteClient represents write client which does not call remote storage, // but instead re-implements fake WriteHandler for test purposes. type TestWriteClient struct { - receivedSamples map[string][]prompb.Sample - expectedSamples map[string][]prompb.Sample - receivedExemplars map[string][]prompb.Exemplar - expectedExemplars map[string][]prompb.Exemplar - receivedHistograms map[string][]prompb.Histogram - receivedFloatHistograms map[string][]prompb.Histogram - expectedHistograms map[string][]prompb.Histogram - expectedFloatHistograms map[string][]prompb.Histogram - receivedMetadata map[string][]prompb.MetricMetadata + receivedSamples map[string][]*prompb.Sample + expectedSamples map[string][]*prompb.Sample + receivedExemplars map[string][]*prompb.Exemplar + expectedExemplars map[string][]*prompb.Exemplar + receivedHistograms map[string][]*prompb.Histogram + receivedFloatHistograms map[string][]*prompb.Histogram + expectedHistograms map[string][]*prompb.Histogram + expectedFloatHistograms map[string][]*prompb.Histogram + receivedMetadata map[string][]*prompb.MetricMetadata writesReceived int mtx sync.Mutex buf []byte @@ -972,9 +972,9 @@ type TestWriteClient struct { // NewTestWriteClient creates a new testing write client. func NewTestWriteClient(protoMsg config.RemoteWriteProtoMsg) *TestWriteClient { return &TestWriteClient{ - receivedSamples: map[string][]prompb.Sample{}, - expectedSamples: map[string][]prompb.Sample{}, - receivedMetadata: map[string][]prompb.MetricMetadata{}, + receivedSamples: map[string][]*prompb.Sample{}, + expectedSamples: map[string][]*prompb.Sample{}, + receivedMetadata: map[string][]*prompb.MetricMetadata{}, protoMsg: protoMsg, storeWait: 0, returnError: nil, @@ -991,12 +991,12 @@ func (c *TestWriteClient) expectSamples(ss []record.RefSample, series []record.R c.mtx.Lock() defer c.mtx.Unlock() - c.expectedSamples = map[string][]prompb.Sample{} - c.receivedSamples = map[string][]prompb.Sample{} + c.expectedSamples = map[string][]*prompb.Sample{} + c.receivedSamples = map[string][]*prompb.Sample{} for _, s := range ss { tsID := getSeriesIDFromRef(series[s.Ref]) - c.expectedSamples[tsID] = append(c.expectedSamples[tsID], prompb.Sample{ + c.expectedSamples[tsID] = append(c.expectedSamples[tsID], &prompb.Sample{ Timestamp: s.T, Value: s.V, }) @@ -1007,12 +1007,12 @@ func (c *TestWriteClient) expectExemplars(ss []record.RefExemplar, series []reco c.mtx.Lock() defer c.mtx.Unlock() - c.expectedExemplars = map[string][]prompb.Exemplar{} - c.receivedExemplars = map[string][]prompb.Exemplar{} + c.expectedExemplars = map[string][]*prompb.Exemplar{} + c.receivedExemplars = map[string][]*prompb.Exemplar{} for _, s := range ss { tsID := getSeriesIDFromRef(series[s.Ref]) - e := prompb.Exemplar{ + e := &prompb.Exemplar{ Labels: prompb.FromLabels(s.Labels, nil), Timestamp: s.T, Value: s.V, @@ -1025,8 +1025,8 @@ func (c *TestWriteClient) expectHistograms(hh []record.RefHistogramSample, serie c.mtx.Lock() defer c.mtx.Unlock() - c.expectedHistograms = map[string][]prompb.Histogram{} - c.receivedHistograms = map[string][]prompb.Histogram{} + c.expectedHistograms = map[string][]*prompb.Histogram{} + c.receivedHistograms = map[string][]*prompb.Histogram{} for _, h := range hh { tsID := getSeriesIDFromRef(series[h.Ref]) @@ -1038,8 +1038,8 @@ func (c *TestWriteClient) expectFloatHistograms(fhs []record.RefFloatHistogramSa c.mtx.Lock() defer c.mtx.Unlock() - c.expectedFloatHistograms = map[string][]prompb.Histogram{} - c.receivedFloatHistograms = map[string][]prompb.Histogram{} + c.expectedFloatHistograms = map[string][]*prompb.Histogram{} + c.receivedFloatHistograms = map[string][]*prompb.Histogram{} for _, fh := range fhs { tsID := getSeriesIDFromRef(series[fh.Ref]) @@ -1193,24 +1193,26 @@ func (c *TestWriteClient) Endpoint() string { func v2RequestToWriteRequest(v2Req *writev2.Request) (*prompb.WriteRequest, error) { req := &prompb.WriteRequest{ - Timeseries: make([]prompb.TimeSeries, len(v2Req.Timeseries)), + Timeseries: make([]*prompb.TimeSeries, len(v2Req.Timeseries)), // TODO handle metadata? } b := labels.NewScratchBuilder(0) for i, rts := range v2Req.Timeseries { rts.ToLabels(&b, v2Req.Symbols).Range(func(l labels.Label) { - req.Timeseries[i].Labels = append(req.Timeseries[i].Labels, prompb.Label{ + req.Timeseries[i] = &prompb.TimeSeries{} + req.Timeseries[i].Labels = append(req.Timeseries[i].Labels, &prompb.Label{ Name: l.Name, Value: l.Value, }) }) - exemplars := make([]prompb.Exemplar, len(rts.Exemplars)) + exemplars := make([]*prompb.Exemplar, len(rts.Exemplars)) for j, e := range rts.Exemplars { + exemplars[j] = &prompb.Exemplar{} exemplars[j].Value = e.Value exemplars[j].Timestamp = e.Timestamp e.ToExemplar(&b, v2Req.Symbols).Labels.Range(func(l labels.Label) { - exemplars[j].Labels = append(exemplars[j].Labels, prompb.Label{ + exemplars[j].Labels = append(exemplars[j].Labels, &prompb.Label{ Name: l.Name, Value: l.Value, }) @@ -1218,13 +1220,13 @@ func v2RequestToWriteRequest(v2Req *writev2.Request) (*prompb.WriteRequest, erro } req.Timeseries[i].Exemplars = exemplars - req.Timeseries[i].Samples = make([]prompb.Sample, len(rts.Samples)) + req.Timeseries[i].Samples = make([]*prompb.Sample, len(rts.Samples)) for j, s := range rts.Samples { req.Timeseries[i].Samples[j].Timestamp = s.Timestamp req.Timeseries[i].Samples[j].Value = s.Value } - req.Timeseries[i].Histograms = make([]prompb.Histogram, len(rts.Histograms)) + req.Timeseries[i].Histograms = make([]*prompb.Histogram, len(rts.Histograms)) for j, h := range rts.Histograms { if h.IsFloatHistogram() { req.Timeseries[i].Histograms[j] = prompb.FromFloatHistogram(h.Timestamp, h.ToFloatHistogram()) @@ -1289,7 +1291,7 @@ func (c *MockWriteClient) Name() string { return c.NameFunc() } func (c *MockWriteClient) Endpoint() string { return c.EndpointFunc() } // Extra labels to make a more realistic workload - taken from Kubernetes' embedded cAdvisor metrics. -var extraLabels []labels.Label = []labels.Label{ +var extraLabels []*labels.Label = []*labels.Label{ {Name: "kubernetes_io_arch", Value: "amd64"}, {Name: "kubernetes_io_instance_type", Value: "c3.somesize"}, {Name: "kubernetes_io_os", Value: "linux"}, @@ -1849,10 +1851,11 @@ func BenchmarkBuildWriteRequest(b *testing.B) { noopLogger := log.NewNopLogger() bench := func(b *testing.B, batch []timeSeries) { buff := make([]byte, 0) - seriesBuff := make([]prompb.TimeSeries, len(batch)) + seriesBuff := make([]*prompb.TimeSeries, len(batch)) for i := range seriesBuff { - seriesBuff[i].Samples = []prompb.Sample{{}} - seriesBuff[i].Exemplars = []prompb.Exemplar{{}} + seriesBuff[i] = &prompb.TimeSeries{} + seriesBuff[i].Samples = []*prompb.Sample{{}} + seriesBuff[i].Exemplars = []*prompb.Exemplar{{}} } pBuf := proto.NewBuffer(nil) @@ -1905,10 +1908,10 @@ func BenchmarkBuildV2WriteRequest(b *testing.B) { for _, tc := range testCases { symbolTable := writev2.NewSymbolTable() buff := make([]byte, 0) - seriesBuff := make([]writev2.TimeSeries, len(tc.batch)) + seriesBuff := make([]*writev2.TimeSeries, len(tc.batch)) for i := range seriesBuff { - seriesBuff[i].Samples = []writev2.Sample{{}} - seriesBuff[i].Exemplars = []writev2.Exemplar{{}} + seriesBuff[i].Samples = []*writev2.Sample{{}} + seriesBuff[i].Exemplars = []*writev2.Exemplar{{}} } pBuf := []byte{} @@ -1989,7 +1992,7 @@ func TestSendSamplesWithBackoffWithSampleAgeLimit(t *testing.T) { m.Start() batchID := 0 - expectedSamples := map[string][]prompb.Sample{} + expectedSamples := map[string][]*prompb.Sample{} appendData := func(numberOfSeries int, timeAdd time.Duration, shouldBeDropped bool) { t.Log(">>>> Appending series ", numberOfSeries, " as batch ID ", batchID, " with timeAdd ", timeAdd, " and should be dropped ", shouldBeDropped) @@ -2000,7 +2003,7 @@ func TestSendSamplesWithBackoffWithSampleAgeLimit(t *testing.T) { if !shouldBeDropped { for _, s := range samples { tsID := getSeriesIDFromRef(series[s.Ref]) - expectedSamples[tsID] = append(c.expectedSamples[tsID], prompb.Sample{ + expectedSamples[tsID] = append(c.expectedSamples[tsID], &prompb.Sample{ Timestamp: s.T, Value: s.V, }) @@ -2097,15 +2100,15 @@ func createTimeseriesWithOldSamples(numSamples, numSeries int, extraLabels ...la return samples, newSamples, series } -func filterTsLimit(limit int64, ts prompb.TimeSeries) bool { +func filterTsLimit(limit int64, ts *prompb.TimeSeries) bool { return limit > ts.Samples[0].Timestamp } func TestBuildTimeSeries(t *testing.T) { testCases := []struct { name string - ts []prompb.TimeSeries - filter func(ts prompb.TimeSeries) bool + ts []*prompb.TimeSeries + filter func(ts *prompb.TimeSeries) bool lowestTs int64 highestTs int64 droppedSamples int @@ -2113,9 +2116,9 @@ func TestBuildTimeSeries(t *testing.T) { }{ { name: "No filter applied", - ts: []prompb.TimeSeries{ + ts: []*prompb.TimeSeries{ { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567890, Value: 1.23, @@ -2123,7 +2126,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567891, Value: 2.34, @@ -2131,7 +2134,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567892, Value: 3.34, @@ -2146,9 +2149,9 @@ func TestBuildTimeSeries(t *testing.T) { }, { name: "Filter applied, samples in order", - ts: []prompb.TimeSeries{ + ts: []*prompb.TimeSeries{ { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567890, Value: 1.23, @@ -2156,7 +2159,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567891, Value: 2.34, @@ -2164,7 +2167,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567892, Value: 3.45, @@ -2172,7 +2175,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567893, Value: 3.45, @@ -2180,7 +2183,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, }, - filter: func(ts prompb.TimeSeries) bool { return filterTsLimit(1234567892, ts) }, + filter: func(ts *prompb.TimeSeries) bool { return filterTsLimit(1234567892, ts) }, responseLen: 2, lowestTs: 1234567892, highestTs: 1234567893, @@ -2188,9 +2191,9 @@ func TestBuildTimeSeries(t *testing.T) { }, { name: "Filter applied, samples out of order", - ts: []prompb.TimeSeries{ + ts: []*prompb.TimeSeries{ { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567892, Value: 3.45, @@ -2198,7 +2201,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567890, Value: 1.23, @@ -2206,7 +2209,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567893, Value: 3.45, @@ -2214,7 +2217,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567891, Value: 2.34, @@ -2222,7 +2225,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, }, - filter: func(ts prompb.TimeSeries) bool { return filterTsLimit(1234567892, ts) }, + filter: func(ts *prompb.TimeSeries) bool { return filterTsLimit(1234567892, ts) }, responseLen: 2, lowestTs: 1234567892, highestTs: 1234567893, @@ -2230,9 +2233,9 @@ func TestBuildTimeSeries(t *testing.T) { }, { name: "Filter applied, samples not consecutive", - ts: []prompb.TimeSeries{ + ts: []*prompb.TimeSeries{ { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567890, Value: 1.23, @@ -2240,7 +2243,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567892, Value: 3.45, @@ -2248,7 +2251,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567895, Value: 6.78, @@ -2256,7 +2259,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, { - Samples: []prompb.Sample{ + Samples: []*prompb.Sample{ { Timestamp: 1234567897, Value: 6.78, @@ -2264,7 +2267,7 @@ func TestBuildTimeSeries(t *testing.T) { }, }, }, - filter: func(ts prompb.TimeSeries) bool { return filterTsLimit(1234567895, ts) }, + filter: func(ts *prompb.TimeSeries) bool { return filterTsLimit(1234567895, ts) }, responseLen: 2, lowestTs: 1234567895, highestTs: 1234567897, @@ -2288,7 +2291,7 @@ func TestBuildTimeSeries(t *testing.T) { func BenchmarkBuildTimeSeries(b *testing.B) { // Send one sample per series, which is the typical remote_write case const numSamples = 10000 - filter := func(ts prompb.TimeSeries) bool { return filterTsLimit(99, ts) } + filter := func(ts *prompb.TimeSeries) bool { return filterTsLimit(99, ts) } for i := 0; i < b.N; i++ { samples := createProtoTimeseriesWithOld(numSamples, 100, extraLabels...) _, _, result, _, _, _ := buildTimeSeries(samples, filter) diff --git a/storage/remote/read_handler_test.go b/storage/remote/read_handler_test.go index a681872687..f78dbc22c9 100644 --- a/storage/remote/read_handler_test.go +++ b/storage/remote/read_handler_test.go @@ -23,9 +23,9 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" "github.com/golang/snappy" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/model/labels" @@ -102,14 +102,14 @@ func TestSampledReadEndpoint(t *testing.T) { require.Equal(t, &prompb.QueryResult{ Timeseries: []*prompb.TimeSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar"}, }, - Samples: []prompb.Sample{{Value: 1, Timestamp: 0}}, + Samples: []*prompb.Sample{{Value: 1, Timestamp: 0}}, }, }, }, resp.Results[0]) @@ -117,13 +117,13 @@ func TestSampledReadEndpoint(t *testing.T) { require.Equal(t, &prompb.QueryResult{ Timeseries: []*prompb.TimeSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_histogram_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, }, - Histograms: []prompb.Histogram{ + Histograms: []*prompb.Histogram{ prompb.FromFloatHistogram(0, tsdbutil.GenerateTestFloatHistogram(0)), }, }, @@ -297,14 +297,14 @@ func TestStreamReadEndpoint(t *testing.T) { { ChunkedSeries: []*prompb.ChunkedSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar1"}, }, - Chunks: []prompb.Chunk{ + Chunks: []*prompb.Chunk{ { Type: prompb.Chunk_XOR, MaxTimeMs: 7140000, @@ -317,14 +317,14 @@ func TestStreamReadEndpoint(t *testing.T) { { ChunkedSeries: []*prompb.ChunkedSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar2"}, }, - Chunks: []prompb.Chunk{ + Chunks: []*prompb.Chunk{ { Type: prompb.Chunk_XOR, MaxTimeMs: 7140000, @@ -343,14 +343,14 @@ func TestStreamReadEndpoint(t *testing.T) { { ChunkedSeries: []*prompb.ChunkedSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar3"}, }, - Chunks: []prompb.Chunk{ + Chunks: []*prompb.Chunk{ { Type: prompb.Chunk_XOR, MaxTimeMs: 7140000, @@ -369,14 +369,14 @@ func TestStreamReadEndpoint(t *testing.T) { { ChunkedSeries: []*prompb.ChunkedSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar3"}, }, - Chunks: []prompb.Chunk{ + Chunks: []*prompb.Chunk{ { Type: prompb.Chunk_XOR, MinTimeMs: 14400000, @@ -390,14 +390,14 @@ func TestStreamReadEndpoint(t *testing.T) { { ChunkedSeries: []*prompb.ChunkedSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, {Name: "foo", Value: "bar1"}, }, - Chunks: []prompb.Chunk{ + Chunks: []*prompb.Chunk{ { Type: prompb.Chunk_XOR, MaxTimeMs: 7140000, @@ -411,13 +411,13 @@ func TestStreamReadEndpoint(t *testing.T) { { ChunkedSeries: []*prompb.ChunkedSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_histogram_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, {Name: "d", Value: "e"}, }, - Chunks: []prompb.Chunk{ + Chunks: []*prompb.Chunk{ { Type: prompb.Chunk_FLOAT_HISTOGRAM, MaxTimeMs: 1440000, diff --git a/storage/remote/read_test.go b/storage/remote/read_test.go index 357bdba1f5..501b22d64e 100644 --- a/storage/remote/read_test.go +++ b/storage/remote/read_test.go @@ -239,9 +239,9 @@ func TestSampleAndChunkQueryableClient(t *testing.T) { m := &mockedRemoteClient{ // Samples does not matter for below tests. store: []*prompb.TimeSeries{ - {Labels: []prompb.Label{{Name: "a", Value: "b"}}}, - {Labels: []prompb.Label{{Name: "a", Value: "b3"}, {Name: "region", Value: "us"}}}, - {Labels: []prompb.Label{{Name: "a", Value: "b2"}, {Name: "region", Value: "europe"}}}, + {Labels: []*prompb.Label{{Name: "a", Value: "b"}}}, + {Labels: []*prompb.Label{{Name: "a", Value: "b3"}, {Name: "region", Value: "us"}}}, + {Labels: []*prompb.Label{{Name: "a", Value: "b2"}, {Name: "region", Value: "europe"}}}, }, b: labels.NewScratchBuilder(0), } diff --git a/storage/remote/write_handler.go b/storage/remote/write_handler.go index b75e7b5dd2..48f1e13f97 100644 --- a/storage/remote/write_handler.go +++ b/storage/remote/write_handler.go @@ -24,10 +24,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/gogo/protobuf/proto" "github.com/golang/snappy" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/model/exemplar" diff --git a/storage/remote/write_handler_test.go b/storage/remote/write_handler_test.go index af2229b9a2..47d117ace7 100644 --- a/storage/remote/write_handler_test.go +++ b/storage/remote/write_handler_test.go @@ -28,9 +28,9 @@ import ( "time" "github.com/go-kit/log" - "github.com/gogo/protobuf/proto" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/model/exemplar" @@ -305,7 +305,7 @@ func TestRemoteWriteHandler_V2Message(t *testing.T) { // V2 supports partial writes for non-retriable errors, so test them. for _, tc := range []struct { desc string - input []writev2.TimeSeries + input []*writev2.TimeSeries expectedCode int expectedRespBody string @@ -324,7 +324,7 @@ func TestRemoteWriteHandler_V2Message(t *testing.T) { desc: "Partial write; first series with invalid labels (no metric name)", input: append( // Series with test_metric1="test_metric1" labels. - []writev2.TimeSeries{{LabelsRefs: []uint32{2, 2}, Samples: []writev2.Sample{{Value: 1, Timestamp: 1}}}}, + []*writev2.TimeSeries{{LabelsRefs: []uint32{2, 2}, Samples: []*writev2.Sample{{Value: 1, Timestamp: 1}}}}, writeV2RequestFixture.Timeseries...), expectedCode: http.StatusBadRequest, expectedRespBody: "invalid metric name or labels, got {test_metric1=\"test_metric1\"}\n", @@ -333,16 +333,16 @@ func TestRemoteWriteHandler_V2Message(t *testing.T) { desc: "Partial write; first series with invalid labels (empty metric name)", input: append( // Series with __name__="" labels. - []writev2.TimeSeries{{LabelsRefs: []uint32{1, 0}, Samples: []writev2.Sample{{Value: 1, Timestamp: 1}}}}, + []*writev2.TimeSeries{{LabelsRefs: []uint32{1, 0}, Samples: []*writev2.Sample{{Value: 1, Timestamp: 1}}}}, writeV2RequestFixture.Timeseries...), expectedCode: http.StatusBadRequest, expectedRespBody: "invalid metric name or labels, got {__name__=\"\"}\n", }, { desc: "Partial write; first series with one OOO sample", - input: func() []writev2.TimeSeries { + input: func() []*writev2.TimeSeries { f := proto.Clone(writeV2RequestFixture).(*writev2.Request) - f.Timeseries[0].Samples = append(f.Timeseries[0].Samples, writev2.Sample{Value: 2, Timestamp: 0}) + f.Timeseries[0].Samples = append(f.Timeseries[0].Samples, &writev2.Sample{Value: 2, Timestamp: 0}) return f.Timeseries }(), expectedCode: http.StatusBadRequest, @@ -350,7 +350,7 @@ func TestRemoteWriteHandler_V2Message(t *testing.T) { }, { desc: "Partial write; first series with one dup sample", - input: func() []writev2.TimeSeries { + input: func() []*writev2.TimeSeries { f := proto.Clone(writeV2RequestFixture).(*writev2.Request) f.Timeseries[0].Samples = append(f.Timeseries[0].Samples, f.Timeseries[0].Samples[0]) return f.Timeseries @@ -360,7 +360,7 @@ func TestRemoteWriteHandler_V2Message(t *testing.T) { }, { desc: "Partial write; first series with one OOO histogram sample", - input: func() []writev2.TimeSeries { + input: func() []*writev2.TimeSeries { f := proto.Clone(writeV2RequestFixture).(*writev2.Request) f.Timeseries[0].Histograms = append(f.Timeseries[0].Histograms, writev2.FromFloatHistogram(1, testHistogram.ToFloat(nil))) return f.Timeseries @@ -370,7 +370,7 @@ func TestRemoteWriteHandler_V2Message(t *testing.T) { }, { desc: "Partial write; first series with one dup histogram sample", - input: func() []writev2.TimeSeries { + input: func() []*writev2.TimeSeries { f := proto.Clone(writeV2RequestFixture).(*writev2.Request) f.Timeseries[0].Histograms = append(f.Timeseries[0].Histograms, f.Timeseries[0].Histograms[1]) return f.Timeseries @@ -525,9 +525,9 @@ func TestOutOfOrderSample_V1Message(t *testing.T) { }, } { t.Run(tc.Name, func(t *testing.T) { - payload, _, _, err := buildWriteRequest(nil, []prompb.TimeSeries{{ - Labels: []prompb.Label{{Name: "__name__", Value: "test_metric"}}, - Samples: []prompb.Sample{{Value: 1, Timestamp: tc.Timestamp}}, + payload, _, _, err := buildWriteRequest(nil, []*prompb.TimeSeries{{ + Labels: []*prompb.Label{{Name: "__name__", Value: "test_metric"}}, + Samples: []*prompb.Sample{{Value: 1, Timestamp: tc.Timestamp}}, }}, nil, nil, nil, nil, "snappy") require.NoError(t, err) @@ -567,9 +567,9 @@ func TestOutOfOrderExemplar_V1Message(t *testing.T) { for _, tc := range tests { t.Run(tc.Name, func(t *testing.T) { - payload, _, _, err := buildWriteRequest(nil, []prompb.TimeSeries{{ - Labels: []prompb.Label{{Name: "__name__", Value: "test_metric"}}, - Exemplars: []prompb.Exemplar{{Labels: []prompb.Label{{Name: "foo", Value: "bar"}}, Value: 1, Timestamp: tc.Timestamp}}, + payload, _, _, err := buildWriteRequest(nil, []*prompb.TimeSeries{{ + Labels: []*prompb.Label{{Name: "__name__", Value: "test_metric"}}, + Exemplars: []*prompb.Exemplar{{Labels: []*prompb.Label{{Name: "foo", Value: "bar"}}, Value: 1, Timestamp: tc.Timestamp}}, }}, nil, nil, nil, nil, "snappy") require.NoError(t, err) @@ -605,9 +605,9 @@ func TestOutOfOrderHistogram_V1Message(t *testing.T) { }, } { t.Run(tc.Name, func(t *testing.T) { - payload, _, _, err := buildWriteRequest(nil, []prompb.TimeSeries{{ - Labels: []prompb.Label{{Name: "__name__", Value: "test_metric"}}, - Histograms: []prompb.Histogram{prompb.FromIntHistogram(tc.Timestamp, &testHistogram), prompb.FromFloatHistogram(1, testHistogram.ToFloat(nil))}, + payload, _, _, err := buildWriteRequest(nil, []*prompb.TimeSeries{{ + Labels: []*prompb.Label{{Name: "__name__", Value: "test_metric"}}, + Histograms: []*prompb.Histogram{prompb.FromIntHistogram(tc.Timestamp, &testHistogram), prompb.FromFloatHistogram(1, testHistogram.ToFloat(nil))}, }}, nil, nil, nil, nil, "snappy") require.NoError(t, err) @@ -631,12 +631,12 @@ func BenchmarkRemoteWriteHandler(b *testing.B) { var reqs []*http.Request for i := 0; i < b.N; i++ { num := strings.Repeat(strconv.Itoa(i), 16) - buf, _, _, err := buildWriteRequest(nil, []prompb.TimeSeries{{ - Labels: []prompb.Label{ + buf, _, _, err := buildWriteRequest(nil, []*prompb.TimeSeries{{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric"}, {Name: "test_label_name_" + num, Value: labelValue + num}, }, - Histograms: []prompb.Histogram{prompb.FromIntHistogram(0, &testHistogram)}, + Histograms: []*prompb.Histogram{prompb.FromIntHistogram(0, &testHistogram)}, }}, nil, nil, nil, nil, "snappy") require.NoError(b, err) req, err := http.NewRequest("", "", bytes.NewReader(buf)) @@ -746,12 +746,12 @@ func BenchmarkRemoteWriteOOOSamples(b *testing.B) { } } -func genSeriesWithSample(numSeries int, ts int64) []prompb.TimeSeries { - var series []prompb.TimeSeries +func genSeriesWithSample(numSeries int, ts int64) []*prompb.TimeSeries { + var series []*prompb.TimeSeries for i := 0; i < numSeries; i++ { - s := prompb.TimeSeries{ - Labels: []prompb.Label{{Name: "__name__", Value: fmt.Sprintf("test_metric_%d", i)}}, - Samples: []prompb.Sample{{Value: float64(i), Timestamp: ts}}, + s := &prompb.TimeSeries{ + Labels: []*prompb.Label{{Name: "__name__", Value: fmt.Sprintf("test_metric_%d", i)}}, + Samples: []*prompb.Sample{{Value: float64(i), Timestamp: ts}}, } series = append(series, s) } diff --git a/util/fmtutil/format.go b/util/fmtutil/format.go index 9efc92ef0a..c331398ceb 100644 --- a/util/fmtutil/format.go +++ b/util/fmtutil/format.go @@ -87,7 +87,7 @@ func MetricFamiliesToWriteRequest(mf map[string]*dto.MetricFamily, extraLabels m } func toTimeseries(wr *prompb.WriteRequest, labels map[string]string, timestamp int64, value float64) { - var ts *prompb.TimeSeries + ts := &prompb.TimeSeries{} ts.Labels = makeLabels(labels) ts.Samples = []*prompb.Sample{ { diff --git a/util/fmtutil/format_test.go b/util/fmtutil/format_test.go index c592630fe8..a4c2bbdc9a 100644 --- a/util/fmtutil/format_test.go +++ b/util/fmtutil/format_test.go @@ -23,7 +23,7 @@ import ( ) var writeRequestFixture = &prompb.WriteRequest{ - Metadata: []prompb.MetricMetadata{ + Metadata: []*prompb.MetricMetadata{ { MetricFamilyName: "http_request_duration_seconds", Type: 3, @@ -45,111 +45,111 @@ var writeRequestFixture = &prompb.WriteRequest{ Help: "This is a test metric.", }, }, - Timeseries: []prompb.TimeSeries{ + Timeseries: []*prompb.TimeSeries{ { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_request_duration_seconds_bucket"}, {Name: "job", Value: "promtool"}, {Name: "le", Value: "0.1"}, }, - Samples: []prompb.Sample{{Value: 33444, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 33444, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_request_duration_seconds_bucket"}, {Name: "job", Value: "promtool"}, {Name: "le", Value: "0.5"}, }, - Samples: []prompb.Sample{{Value: 129389, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 129389, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_request_duration_seconds_bucket"}, {Name: "job", Value: "promtool"}, {Name: "le", Value: "1"}, }, - Samples: []prompb.Sample{{Value: 133988, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 133988, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_request_duration_seconds_bucket"}, {Name: "job", Value: "promtool"}, {Name: "le", Value: "+Inf"}, }, - Samples: []prompb.Sample{{Value: 144320, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 144320, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_request_duration_seconds_sum"}, {Name: "job", Value: "promtool"}, }, - Samples: []prompb.Sample{{Value: 53423, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 53423, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_request_duration_seconds_count"}, {Name: "job", Value: "promtool"}, }, - Samples: []prompb.Sample{{Value: 144320, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 144320, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_requests_total"}, {Name: "code", Value: "200"}, {Name: "job", Value: "promtool"}, {Name: "method", Value: "post"}, }, - Samples: []prompb.Sample{{Value: 1027, Timestamp: 1395066363000}}, + Samples: []*prompb.Sample{{Value: 1027, Timestamp: 1395066363000}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "http_requests_total"}, {Name: "code", Value: "400"}, {Name: "job", Value: "promtool"}, {Name: "method", Value: "post"}, }, - Samples: []prompb.Sample{{Value: 3, Timestamp: 1395066363000}}, + Samples: []*prompb.Sample{{Value: 3, Timestamp: 1395066363000}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "rpc_duration_seconds"}, {Name: "job", Value: "promtool"}, {Name: "quantile", Value: "0.01"}, }, - Samples: []prompb.Sample{{Value: 3102, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 3102, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "rpc_duration_seconds"}, {Name: "job", Value: "promtool"}, {Name: "quantile", Value: "0.5"}, }, - Samples: []prompb.Sample{{Value: 4773, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 4773, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "rpc_duration_seconds"}, {Name: "job", Value: "promtool"}, {Name: "quantile", Value: "0.99"}, }, - Samples: []prompb.Sample{{Value: 76656, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 76656, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "rpc_duration_seconds_sum"}, {Name: "job", Value: "promtool"}, }, - Samples: []prompb.Sample{{Value: 1.7560473e+07, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 1.7560473e+07, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "rpc_duration_seconds_count"}, {Name: "job", Value: "promtool"}, }, - Samples: []prompb.Sample{{Value: 2693, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 2693, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, @@ -157,10 +157,10 @@ var writeRequestFixture = &prompb.WriteRequest{ {Name: "foo", Value: "bar"}, {Name: "job", Value: "promtool"}, }, - Samples: []prompb.Sample{{Value: 1, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 1, Timestamp: 1}}, }, { - Labels: []prompb.Label{ + Labels: []*prompb.Label{ {Name: "__name__", Value: "test_metric1"}, {Name: "b", Value: "c"}, {Name: "baz", Value: "qux"}, @@ -168,7 +168,7 @@ var writeRequestFixture = &prompb.WriteRequest{ {Name: "foo", Value: "bar"}, {Name: "job", Value: "promtool"}, }, - Samples: []prompb.Sample{{Value: 2, Timestamp: 1}}, + Samples: []*prompb.Sample{{Value: 2, Timestamp: 1}}, }, }, } diff --git a/web/federate.go b/web/federate.go index 8176eba365..d49adff302 100644 --- a/web/federate.go +++ b/web/federate.go @@ -22,11 +22,11 @@ import ( "strings" "github.com/go-kit/log/level" - "github.com/gogo/protobuf/proto" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/expfmt" "github.com/prometheus/common/model" + "google.golang.org/protobuf/proto" "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels"