From fd7302b2e87f64be3459e13d7262fd7cda0b8933 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Sat, 7 Mar 2020 16:59:40 +0000 Subject: [PATCH] Made storepb.RuleGroups a source of truth for rules API (Go, JSON, proto). Added tests. Signed-off-by: Bartlomiej Plotka --- go.sum | 1 + pkg/store/storepb/custom.go | 7 + pkg/store/storepb/rpc.pb.go | 3238 +++++------------------- pkg/store/storepb/rpc.proto | 80 +- pkg/store/storepb/rules.pb.go | 2693 ++++++++++++++++++++ pkg/store/storepb/rules.proto | 109 + pkg/store/storepb/rules_custom.go | 132 + pkg/store/storepb/rules_custom_test.go | 427 ++++ pkg/store/storepb/types.pb.go | 96 +- pkg/store/storepb/types.proto | 14 + scripts/genproto.sh | 5 +- 11 files changed, 4146 insertions(+), 2656 deletions(-) create mode 100644 pkg/store/storepb/rules.pb.go create mode 100644 pkg/store/storepb/rules.proto create mode 100644 pkg/store/storepb/rules_custom.go create mode 100644 pkg/store/storepb/rules_custom_test.go diff --git a/go.sum b/go.sum index 787df65dae..23c863ac15 100644 --- a/go.sum +++ b/go.sum @@ -681,6 +681,7 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= diff --git a/pkg/store/storepb/custom.go b/pkg/store/storepb/custom.go index ea13089be4..eb83c5246c 100644 --- a/pkg/store/storepb/custom.go +++ b/pkg/store/storepb/custom.go @@ -171,7 +171,14 @@ func LabelsToPromLabels(lset []Label) labels.Labels { for i, l := range lset { ret[i] = labels.Label{Name: l.Name, Value: l.Value} } + return ret +} +func PromLabelsToLabels(lset labels.Labels) []Label { + ret := make([]Label, len(lset)) + for i, l := range lset { + ret[i] = Label{Name: l.Name, Value: l.Value} + } return ret } diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index db64f88b45..464644c98d 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -5,7 +5,6 @@ package storepb import ( context "context" - encoding_binary "encoding/binary" fmt "fmt" io "io" math "math" @@ -67,40 +66,6 @@ func (StoreType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_77a6da22d6a3feb1, []int{0} } -/// PartialResponseStrategy controls partial response handling. -type PartialResponseStrategy int32 - -const ( - /// WARN strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying - /// storeAPI is temporarily not available) as warning which will not fail the whole query (still OK response). - /// Server should produce those as a warnings field in response. - PartialResponseStrategy_WARN PartialResponseStrategy = 0 - /// ABORT strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying - /// storeAPI is temporarily not available) as the gRPC error that aborts the query. - /// - /// This is especially useful for any rule/alert evaluations on top of StoreAPI which usually does not tolerate partial - /// errors. - PartialResponseStrategy_ABORT PartialResponseStrategy = 1 -) - -var PartialResponseStrategy_name = map[int32]string{ - 0: "WARN", - 1: "ABORT", -} - -var PartialResponseStrategy_value = map[string]int32{ - "WARN": 0, - "ABORT": 1, -} - -func (x PartialResponseStrategy) String() string { - return proto.EnumName(PartialResponseStrategy_name, int32(x)) -} - -func (PartialResponseStrategy) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{1} -} - type Aggr int32 const ( @@ -135,35 +100,7 @@ func (x Aggr) String() string { } func (Aggr) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{2} -} - -type Alert_State int32 - -const ( - Alert_PENDING Alert_State = 0 - Alert_FIRING Alert_State = 1 - Alert_INACTIVE Alert_State = 2 -) - -var Alert_State_name = map[int32]string{ - 0: "PENDING", - 1: "FIRING", - 2: "INACTIVE", -} - -var Alert_State_value = map[string]int32{ - "PENDING": 0, - "FIRING": 1, - "INACTIVE": 2, -} - -func (x Alert_State) String() string { - return proto.EnumName(Alert_State_name, int32(x)) -} - -func (Alert_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{13, 0} + return fileDescriptor_77a6da22d6a3feb1, []int{1} } type RulesRequest_Type int32 @@ -191,7 +128,7 @@ func (x RulesRequest_Type) String() string { } func (RulesRequest_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{15, 0} + return fileDescriptor_77a6da22d6a3feb1, []int{11, 0} } type WriteResponse struct { @@ -672,236 +609,16 @@ func (m *LabelValuesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_LabelValuesResponse proto.InternalMessageInfo -/// RuleGroup has info for rules which are part of a group. -type RuleGroup struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - File string `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"` - // In order to preserve rule ordering, while exposing type (alerting or recording) - // specific properties, both alerting and recording rules are exposed in the - // same array. - Rules []*Rule `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules,omitempty"` - Interval float64 `protobuf:"fixed64,4,opt,name=interval,proto3" json:"interval,omitempty"` - EvaluationTime int64 `protobuf:"varint,5,opt,name=evaluation_time,json=evaluationTime,proto3" json:"evaluation_time,omitempty"` - LastEvaluationTime int64 `protobuf:"varint,6,opt,name=last_evaluation_time,json=lastEvaluationTime,proto3" json:"last_evaluation_time,omitempty"` -} - -func (m *RuleGroup) Reset() { *m = RuleGroup{} } -func (m *RuleGroup) String() string { return proto.CompactTextString(m) } -func (*RuleGroup) ProtoMessage() {} -func (*RuleGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{11} -} -func (m *RuleGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RuleGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RuleGroup.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RuleGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_RuleGroup.Merge(m, src) -} -func (m *RuleGroup) XXX_Size() int { - return m.Size() -} -func (m *RuleGroup) XXX_DiscardUnknown() { - xxx_messageInfo_RuleGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_RuleGroup proto.InternalMessageInfo - -type Rule struct { - // Types that are valid to be assigned to Result: - // *Rule_RecordingRule - // *Rule_Alert - Result isRule_Result `protobuf_oneof:"result"` -} - -func (m *Rule) Reset() { *m = Rule{} } -func (m *Rule) String() string { return proto.CompactTextString(m) } -func (*Rule) ProtoMessage() {} -func (*Rule) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{12} -} -func (m *Rule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Rule.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Rule) XXX_Merge(src proto.Message) { - xxx_messageInfo_Rule.Merge(m, src) -} -func (m *Rule) XXX_Size() int { - return m.Size() -} -func (m *Rule) XXX_DiscardUnknown() { - xxx_messageInfo_Rule.DiscardUnknown(m) -} - -var xxx_messageInfo_Rule proto.InternalMessageInfo - -type isRule_Result interface { - isRule_Result() - MarshalTo([]byte) (int, error) - Size() int -} - -type Rule_RecordingRule struct { - RecordingRule *RecordingRule `protobuf:"bytes,1,opt,name=recording_rule,json=recordingRule,proto3,oneof" json:"recording_rule,omitempty"` -} -type Rule_Alert struct { - Alert *Alert `protobuf:"bytes,2,opt,name=alert,proto3,oneof" json:"alert,omitempty"` -} - -func (*Rule_RecordingRule) isRule_Result() {} -func (*Rule_Alert) isRule_Result() {} - -func (m *Rule) GetResult() isRule_Result { - if m != nil { - return m.Result - } - return nil -} - -func (m *Rule) GetRecordingRule() *RecordingRule { - if x, ok := m.GetResult().(*Rule_RecordingRule); ok { - return x.RecordingRule - } - return nil -} - -func (m *Rule) GetAlert() *Alert { - if x, ok := m.GetResult().(*Rule_Alert); ok { - return x.Alert - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Rule) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Rule_RecordingRule)(nil), - (*Rule_Alert)(nil), - } -} - -type Alert struct { - State Alert_State `protobuf:"varint,1,opt,name=state,proto3,enum=thanos.Alert_State" json:"state,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` - DurationSeconds float64 `protobuf:"fixed64,4,opt,name=duration_seconds,json=durationSeconds,proto3" json:"duration_seconds,omitempty"` - Labels []*Label `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty"` - Annotations []*Label `protobuf:"bytes,6,rep,name=annotations,proto3" json:"annotations,omitempty"` - Alerts []*Alert `protobuf:"bytes,7,rep,name=alerts,proto3" json:"alerts,omitempty"` - Health string `protobuf:"bytes,8,opt,name=health,proto3" json:"health,omitempty"` - LastError string `protobuf:"bytes,9,opt,name=last_error,json=lastError,proto3" json:"last_error,omitempty"` - EvaluationDurationSeconds float64 `protobuf:"fixed64,10,opt,name=evaluation_duration_seconds,json=evaluationDurationSeconds,proto3" json:"evaluation_duration_seconds,omitempty"` - LastEvaluationTime int64 `protobuf:"varint,11,opt,name=last_evaluation_time,json=lastEvaluationTime,proto3" json:"last_evaluation_time,omitempty"` -} - -func (m *Alert) Reset() { *m = Alert{} } -func (m *Alert) String() string { return proto.CompactTextString(m) } -func (*Alert) ProtoMessage() {} -func (*Alert) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{13} -} -func (m *Alert) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Alert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Alert.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Alert) XXX_Merge(src proto.Message) { - xxx_messageInfo_Alert.Merge(m, src) -} -func (m *Alert) XXX_Size() int { - return m.Size() -} -func (m *Alert) XXX_DiscardUnknown() { - xxx_messageInfo_Alert.DiscardUnknown(m) -} - -var xxx_messageInfo_Alert proto.InternalMessageInfo - -type RecordingRule struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` - Labels []*Label `protobuf:"bytes,3,rep,name=labels,proto3" json:"labels,omitempty"` - Health string `protobuf:"bytes,4,opt,name=health,proto3" json:"health,omitempty"` - LastError string `protobuf:"bytes,5,opt,name=last_error,json=lastError,proto3" json:"last_error,omitempty"` - EvaluationDurationSeconds float64 `protobuf:"fixed64,6,opt,name=evaluation_duration_seconds,json=evaluationDurationSeconds,proto3" json:"evaluation_duration_seconds,omitempty"` - LastEvaluationTime int64 `protobuf:"varint,7,opt,name=last_evaluation_time,json=lastEvaluationTime,proto3" json:"last_evaluation_time,omitempty"` -} - -func (m *RecordingRule) Reset() { *m = RecordingRule{} } -func (m *RecordingRule) String() string { return proto.CompactTextString(m) } -func (*RecordingRule) ProtoMessage() {} -func (*RecordingRule) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{14} -} -func (m *RecordingRule) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RecordingRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RecordingRule.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RecordingRule) XXX_Merge(src proto.Message) { - xxx_messageInfo_RecordingRule.Merge(m, src) -} -func (m *RecordingRule) XXX_Size() int { - return m.Size() -} -func (m *RecordingRule) XXX_DiscardUnknown() { - xxx_messageInfo_RecordingRule.DiscardUnknown(m) -} - -var xxx_messageInfo_RecordingRule proto.InternalMessageInfo - type RulesRequest struct { - Type RulesRequest_Type `protobuf:"varint,1,opt,name=type,proto3,enum=thanos.RulesRequest_Type" json:"type,omitempty"` + Type RulesRequest_Type `protobuf:"varint,1,opt,name=type,proto3,enum=thanos.RulesRequest_Type" json:"type,omitempty"` + PartialResponseStrategy PartialResponseStrategy `protobuf:"varint,2,opt,name=partial_response_strategy,json=partialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partial_response_strategy,omitempty"` } func (m *RulesRequest) Reset() { *m = RulesRequest{} } func (m *RulesRequest) String() string { return proto.CompactTextString(m) } func (*RulesRequest) ProtoMessage() {} func (*RulesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{15} + return fileDescriptor_77a6da22d6a3feb1, []int{11} } func (m *RulesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -930,43 +647,6 @@ func (m *RulesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_RulesRequest proto.InternalMessageInfo -type RuleGroups struct { - Groups []*RuleGroup `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups,omitempty"` -} - -func (m *RuleGroups) Reset() { *m = RuleGroups{} } -func (m *RuleGroups) String() string { return proto.CompactTextString(m) } -func (*RuleGroups) ProtoMessage() {} -func (*RuleGroups) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{16} -} -func (m *RuleGroups) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RuleGroups) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RuleGroups.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RuleGroups) XXX_Merge(src proto.Message) { - xxx_messageInfo_RuleGroups.Merge(m, src) -} -func (m *RuleGroups) XXX_Size() int { - return m.Size() -} -func (m *RuleGroups) XXX_DiscardUnknown() { - xxx_messageInfo_RuleGroups.DiscardUnknown(m) -} - -var xxx_messageInfo_RuleGroups proto.InternalMessageInfo - type RulesResponse struct { // Types that are valid to be assigned to Result: // *RulesResponse_Group @@ -978,7 +658,7 @@ func (m *RulesResponse) Reset() { *m = RulesResponse{} } func (m *RulesResponse) String() string { return proto.CompactTextString(m) } func (*RulesResponse) ProtoMessage() {} func (*RulesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{17} + return fileDescriptor_77a6da22d6a3feb1, []int{12} } func (m *RulesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1054,9 +734,7 @@ func (*RulesResponse) XXX_OneofWrappers() []interface{} { func init() { proto.RegisterEnum("thanos.StoreType", StoreType_name, StoreType_value) - proto.RegisterEnum("thanos.PartialResponseStrategy", PartialResponseStrategy_name, PartialResponseStrategy_value) proto.RegisterEnum("thanos.Aggr", Aggr_name, Aggr_value) - proto.RegisterEnum("thanos.Alert_State", Alert_State_name, Alert_State_value) proto.RegisterEnum("thanos.RulesRequest_Type", RulesRequest_Type_name, RulesRequest_Type_value) proto.RegisterType((*WriteResponse)(nil), "thanos.WriteResponse") proto.RegisterType((*WriteRequest)(nil), "thanos.WriteRequest") @@ -1069,108 +747,79 @@ func init() { proto.RegisterType((*LabelNamesResponse)(nil), "thanos.LabelNamesResponse") proto.RegisterType((*LabelValuesRequest)(nil), "thanos.LabelValuesRequest") proto.RegisterType((*LabelValuesResponse)(nil), "thanos.LabelValuesResponse") - proto.RegisterType((*RuleGroup)(nil), "thanos.RuleGroup") - proto.RegisterType((*Rule)(nil), "thanos.Rule") - proto.RegisterType((*Alert)(nil), "thanos.Alert") - proto.RegisterType((*RecordingRule)(nil), "thanos.RecordingRule") proto.RegisterType((*RulesRequest)(nil), "thanos.RulesRequest") - proto.RegisterType((*RuleGroups)(nil), "thanos.RuleGroups") proto.RegisterType((*RulesResponse)(nil), "thanos.RulesResponse") } func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } var fileDescriptor_77a6da22d6a3feb1 = []byte{ - // 1421 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x4f, 0x73, 0xd3, 0x46, - 0x14, 0xb7, 0x6c, 0x4b, 0xb6, 0x9e, 0x63, 0x23, 0x16, 0x27, 0x28, 0x66, 0x6a, 0x32, 0x9a, 0x61, - 0xea, 0x50, 0xea, 0x50, 0x33, 0x85, 0x69, 0x87, 0xa1, 0xe3, 0x38, 0x86, 0x78, 0x1a, 0x1c, 0xba, - 0x76, 0x48, 0xff, 0x1c, 0x8c, 0xe2, 0x2c, 0xb6, 0x06, 0x59, 0x32, 0x2b, 0x99, 0xc0, 0xa5, 0x87, - 0xde, 0x7a, 0xeb, 0xb5, 0xdf, 0xa1, 0xdf, 0xa2, 0x17, 0x4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 0xf3, 0xf6, 0x43, 0xb7, 0xc3, 0x45, 0x79, 0xd1, 0x60, 0xcc, 0x0d, - 0x24, 0x9a, 0xf5, 0xa6, 0xb4, 0x79, 0xed, 0xf5, 0x3f, 0xd5, 0xd4, 0xeb, 0xb7, 0x55, 0xe9, 0xcd, - 0xdb, 0xaa, 0xf4, 0xf7, 0xdb, 0xaa, 0xf4, 0xd3, 0xbb, 0x6a, 0xea, 0xcd, 0xbb, 0x6a, 0xea, 0xf7, - 0x77, 0xd5, 0xd4, 0xb7, 0x39, 0xfe, 0xf3, 0x30, 0x3d, 0x38, 0x50, 0xf8, 0x6f, 0xd8, 0xad, 0x7f, - 0x03, 0x00, 0x00, 0xff, 0xff, 0xac, 0x53, 0x7d, 0x19, 0xf3, 0x0d, 0x00, 0x00, + // 1036 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xf7, 0xc4, 0xf9, 0xfb, 0xd2, 0x04, 0x77, 0x9a, 0x16, 0x37, 0x48, 0x69, 0x65, 0x09, 0x29, + 0x2c, 0x4b, 0xba, 0x64, 0xc5, 0x22, 0xd0, 0x4a, 0x28, 0x4d, 0xb3, 0xdb, 0x88, 0x36, 0x85, 0x49, + 0xbb, 0xe5, 0xcf, 0xa1, 0xeb, 0xb4, 0x83, 0x6b, 0x6d, 0x62, 0x1b, 0xcf, 0x84, 0xb6, 0x17, 0x0e, + 0x7c, 0x02, 0xae, 0x7c, 0x07, 0xbe, 0x05, 0x97, 0x1e, 0xf7, 0x08, 0x17, 0x04, 0xed, 0x17, 0x41, + 0x33, 0x1e, 0x27, 0x76, 0x29, 0x15, 0xa8, 0xe2, 0x36, 0xef, 0xfd, 0x9e, 0xdf, 0x9f, 0xdf, 0xbc, + 0xf7, 0x3c, 0x50, 0x0a, 0x83, 0xe3, 0x56, 0x10, 0xfa, 0xdc, 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x64, 0x02, 0x3a, 0x29, 0x4c, 0x5c, 0x4f, 0x64, 0x2c, 0x21, 0xfb, 0x3c, 0x82, 0x54, 0x0a, 0x13, + 0xfb, 0x5c, 0x42, 0x1b, 0x50, 0x62, 0xdc, 0x0f, 0xe9, 0xfe, 0x45, 0x40, 0xcd, 0xec, 0x3a, 0x6a, + 0x56, 0xdb, 0x8b, 0x71, 0x94, 0x61, 0x0c, 0x90, 0xb9, 0x0d, 0xfe, 0x00, 0x40, 0x06, 0x3c, 0x62, + 0x94, 0x33, 0x33, 0x27, 0xf3, 0x32, 0x52, 0x79, 0x0d, 0x29, 0x57, 0xa9, 0x95, 0xc6, 0x4a, 0x66, + 0xd6, 0x87, 0x50, 0x8c, 0xc1, 0xff, 0x54, 0x96, 0xf5, 0x93, 0x0e, 0x95, 0x88, 0xf2, 0xf8, 0x96, + 0x92, 0x85, 0xa2, 0x7f, 0x2e, 0x34, 0x93, 0x2e, 0xf4, 0x89, 0x80, 0xf8, 0xf1, 0x29, 0x0d, 0x99, + 0xa9, 0xcb, 0xb0, 0xb5, 0x54, 0xd8, 0xdd, 0x08, 0x54, 0xd1, 0x67, 0xb6, 0xb8, 0x0d, 0xcb, 0xc2, + 0x65, 0x48, 0x99, 0x3f, 0x9e, 0x72, 0xd7, 0xf7, 0x8e, 0xce, 0x5c, 0xef, 0xc4, 0x3f, 0x93, 0x64, + 0xe9, 0x64, 0x69, 0x62, 0x9f, 0x93, 0x19, 0x76, 0x28, 0x21, 0xfc, 0x10, 0xc0, 0x76, 0x9c, 0x90, + 0x3a, 0x36, 0xa7, 0x11, 0x47, 0xd5, 0xf6, 0x42, 0x1c, 0xad, 0xe3, 0x38, 0x21, 0x49, 0xe0, 0xf8, + 0x63, 0x58, 0x0d, 0xec, 0x90, 0xbb, 0xf6, 0x58, 0x44, 0x91, 0x37, 0x7f, 0x74, 0xe2, 0x32, 0x7b, + 0x34, 0xa6, 0x27, 0x66, 0x7e, 0x1d, 0x35, 0x8b, 0xe4, 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 0x7a, 0xfc, 0x57, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x51, 0xa1, 0x1b, 0x77, 0xbd, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2111,7 +1760,7 @@ func (m *LabelValuesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *RuleGroup) Marshal() (dAtA []byte, err error) { +func (m *RulesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2121,64 +1770,30 @@ func (m *RuleGroup) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RuleGroup) MarshalTo(dAtA []byte) (int, error) { +func (m *RulesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RuleGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.LastEvaluationTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.LastEvaluationTime)) - i-- - dAtA[i] = 0x30 - } - if m.EvaluationTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.EvaluationTime)) - i-- - dAtA[i] = 0x28 - } - if m.Interval != 0 { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Interval)))) - i-- - dAtA[i] = 0x21 - } - if len(m.Rules) > 0 { - for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.File) > 0 { - i -= len(m.File) - copy(dAtA[i:], m.File) - i = encodeVarintRpc(dAtA, i, uint64(len(m.File))) + if m.PartialResponseStrategy != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.PartialResponseStrategy)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + if m.Type != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Type)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *Rule) Marshal() (dAtA []byte, err error) { +func (m *RulesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2188,12 +1803,12 @@ func (m *Rule) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Rule) MarshalTo(dAtA []byte) (int, error) { +func (m *RulesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Rule) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2210,16 +1825,16 @@ func (m *Rule) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Rule_RecordingRule) MarshalTo(dAtA []byte) (int, error) { +func (m *RulesResponse_Group) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Rule_RecordingRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RulesResponse_Group) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.RecordingRule != nil { + if m.Group != nil { { - size, err := m.RecordingRule.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Group.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2231,533 +1846,203 @@ func (m *Rule_RecordingRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *Rule_Alert) MarshalTo(dAtA []byte) (int, error) { +func (m *RulesResponse_Warning) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Rule_Alert) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RulesResponse_Warning) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.Alert != nil { - { - size, err := m.Alert.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } + i -= len(m.Warning) + copy(dAtA[i:], m.Warning) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Warning))) + i-- + dAtA[i] = 0x12 return len(dAtA) - i, nil } -func (m *Alert) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { + offset -= sovRpc(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil + dAtA[offset] = uint8(v) + return base } - -func (m *Alert) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *WriteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n } -func (m *Alert) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *WriteRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.LastEvaluationTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.LastEvaluationTime)) - i-- - dAtA[i] = 0x58 - } - if m.EvaluationDurationSeconds != 0 { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.EvaluationDurationSeconds)))) - i-- - dAtA[i] = 0x51 + if len(m.Timeseries) > 0 { + for _, e := range m.Timeseries { + l = e.Size() + n += 1 + l + sovRpc(uint64(l)) + } } - if len(m.LastError) > 0 { - i -= len(m.LastError) - copy(dAtA[i:], m.LastError) - i = encodeVarintRpc(dAtA, i, uint64(len(m.LastError))) - i-- - dAtA[i] = 0x4a + l = len(m.Tenant) + if l > 0 { + n += 1 + l + sovRpc(uint64(l)) } - if len(m.Health) > 0 { - i -= len(m.Health) - copy(dAtA[i:], m.Health) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Health))) - i-- - dAtA[i] = 0x42 + if m.Replica != 0 { + n += 1 + sovRpc(uint64(m.Replica)) } - if len(m.Alerts) > 0 { - for iNdEx := len(m.Alerts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Alerts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } + return n +} + +func (m *InfoRequest) Size() (n int) { + if m == nil { + return 0 } - if len(m.Annotations) > 0 { - for iNdEx := len(m.Annotations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Annotations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } + var l int + _ = l + return n +} + +func (m *InfoResponse) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l if len(m.Labels) > 0 { - for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a + for _, e := range m.Labels { + l = e.Size() + n += 1 + l + sovRpc(uint64(l)) } } - if m.DurationSeconds != 0 { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.DurationSeconds)))) - i-- - dAtA[i] = 0x21 + if m.MinTime != 0 { + n += 1 + sovRpc(uint64(m.MinTime)) } - if len(m.Query) > 0 { - i -= len(m.Query) - copy(dAtA[i:], m.Query) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Query))) - i-- - dAtA[i] = 0x1a + if m.MaxTime != 0 { + n += 1 + sovRpc(uint64(m.MaxTime)) } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 + if m.StoreType != 0 { + n += 1 + sovRpc(uint64(m.StoreType)) } - if m.State != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x8 + if len(m.LabelSets) > 0 { + for _, e := range m.LabelSets { + l = e.Size() + n += 1 + l + sovRpc(uint64(l)) + } } - return len(dAtA) - i, nil + return n } -func (m *RecordingRule) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *LabelSet) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *RecordingRule) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + var l int + _ = l + if len(m.Labels) > 0 { + for _, e := range m.Labels { + l = e.Size() + n += 1 + l + sovRpc(uint64(l)) + } + } + return n } -func (m *RecordingRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *SeriesRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.LastEvaluationTime != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.LastEvaluationTime)) - i-- - dAtA[i] = 0x38 + if m.MinTime != 0 { + n += 1 + sovRpc(uint64(m.MinTime)) } - if m.EvaluationDurationSeconds != 0 { - i -= 8 - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.EvaluationDurationSeconds)))) - i-- - dAtA[i] = 0x31 + if m.MaxTime != 0 { + n += 1 + sovRpc(uint64(m.MaxTime)) } - if len(m.LastError) > 0 { - i -= len(m.LastError) - copy(dAtA[i:], m.LastError) - i = encodeVarintRpc(dAtA, i, uint64(len(m.LastError))) - i-- - dAtA[i] = 0x2a + if len(m.Matchers) > 0 { + for _, e := range m.Matchers { + l = e.Size() + n += 1 + l + sovRpc(uint64(l)) + } } - if len(m.Health) > 0 { - i -= len(m.Health) - copy(dAtA[i:], m.Health) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Health))) - i-- - dAtA[i] = 0x22 + if m.MaxResolutionWindow != 0 { + n += 1 + sovRpc(uint64(m.MaxResolutionWindow)) } - if len(m.Labels) > 0 { - for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + if len(m.Aggregates) > 0 { + l = 0 + for _, e := range m.Aggregates { + l += sovRpc(uint64(e)) } + n += 1 + sovRpc(uint64(l)) + l } - if len(m.Query) > 0 { - i -= len(m.Query) - copy(dAtA[i:], m.Query) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Query))) - i-- - dAtA[i] = 0x12 + if m.PartialResponseDisabled { + n += 2 } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa + if m.PartialResponseStrategy != 0 { + n += 1 + sovRpc(uint64(m.PartialResponseStrategy)) } - return len(dAtA) - i, nil -} - -func (m *RulesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.SkipChunks { + n += 2 } - return dAtA[:n], nil -} - -func (m *RulesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *RulesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *SeriesResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.Type != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 + if m.Result != nil { + n += m.Result.Size() } - return len(dAtA) - i, nil + return n } -func (m *RuleGroups) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *SeriesResponse_Series) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *RuleGroups) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RuleGroups) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if len(m.Groups) > 0 { - for iNdEx := len(m.Groups) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Groups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if m.Series != nil { + l = m.Series.Size() + n += 1 + l + sovRpc(uint64(l)) } - return len(dAtA) - i, nil + return n } - -func (m *RulesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *SeriesResponse_Warning) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *RulesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + var l int + _ = l + l = len(m.Warning) + n += 1 + l + sovRpc(uint64(l)) + return n } - -func (m *RulesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *LabelNamesRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.Result != nil { - { - size := m.Result.Size() - i -= size - if _, err := m.Result.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } + if m.PartialResponseDisabled { + n += 2 } - return len(dAtA) - i, nil -} - -func (m *RulesResponse_Group) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RulesResponse_Group) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Group != nil { - { - size, err := m.Group.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRpc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *RulesResponse_Warning) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RulesResponse_Warning) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.Warning) - copy(dAtA[i:], m.Warning) - i = encodeVarintRpc(dAtA, i, uint64(len(m.Warning))) - i-- - dAtA[i] = 0x12 - return len(dAtA) - i, nil -} -func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { - offset -= sovRpc(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *WriteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *WriteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Timeseries) > 0 { - for _, e := range m.Timeseries { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - l = len(m.Tenant) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.Replica != 0 { - n += 1 + sovRpc(uint64(m.Replica)) - } - return n -} - -func (m *InfoRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *InfoResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Labels) > 0 { - for _, e := range m.Labels { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.MinTime != 0 { - n += 1 + sovRpc(uint64(m.MinTime)) - } - if m.MaxTime != 0 { - n += 1 + sovRpc(uint64(m.MaxTime)) - } - if m.StoreType != 0 { - n += 1 + sovRpc(uint64(m.StoreType)) - } - if len(m.LabelSets) > 0 { - for _, e := range m.LabelSets { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - return n -} - -func (m *LabelSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Labels) > 0 { - for _, e := range m.Labels { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - return n -} - -func (m *SeriesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinTime != 0 { - n += 1 + sovRpc(uint64(m.MinTime)) - } - if m.MaxTime != 0 { - n += 1 + sovRpc(uint64(m.MaxTime)) - } - if len(m.Matchers) > 0 { - for _, e := range m.Matchers { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.MaxResolutionWindow != 0 { - n += 1 + sovRpc(uint64(m.MaxResolutionWindow)) - } - if len(m.Aggregates) > 0 { - l = 0 - for _, e := range m.Aggregates { - l += sovRpc(uint64(e)) - } - n += 1 + sovRpc(uint64(l)) + l - } - if m.PartialResponseDisabled { - n += 2 - } - if m.PartialResponseStrategy != 0 { - n += 1 + sovRpc(uint64(m.PartialResponseStrategy)) - } - if m.SkipChunks { - n += 2 - } - return n -} - -func (m *SeriesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Result != nil { - n += m.Result.Size() - } - return n -} - -func (m *SeriesResponse_Series) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Series != nil { - l = m.Series.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *SeriesResponse_Warning) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Warning) - n += 1 + l + sovRpc(uint64(l)) - return n -} -func (m *LabelNamesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PartialResponseDisabled { - n += 2 - } - if m.PartialResponseStrategy != 0 { - n += 1 + sovRpc(uint64(m.PartialResponseStrategy)) - } - return n + if m.PartialResponseStrategy != 0 { + n += 1 + sovRpc(uint64(m.PartialResponseStrategy)) + } + return n } func (m *LabelNamesResponse) Size() (n int) { @@ -2821,194 +2106,22 @@ func (m *LabelValuesResponse) Size() (n int) { return n } -func (m *RuleGroup) Size() (n int) { +func (m *RulesRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.File) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Rules) > 0 { - for _, e := range m.Rules { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.Interval != 0 { - n += 9 - } - if m.EvaluationTime != 0 { - n += 1 + sovRpc(uint64(m.EvaluationTime)) + if m.Type != 0 { + n += 1 + sovRpc(uint64(m.Type)) } - if m.LastEvaluationTime != 0 { - n += 1 + sovRpc(uint64(m.LastEvaluationTime)) + if m.PartialResponseStrategy != 0 { + n += 1 + sovRpc(uint64(m.PartialResponseStrategy)) } return n } -func (m *Rule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Result != nil { - n += m.Result.Size() - } - return n -} - -func (m *Rule_RecordingRule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RecordingRule != nil { - l = m.RecordingRule.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *Rule_Alert) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Alert != nil { - l = m.Alert.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *Alert) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.State != 0 { - n += 1 + sovRpc(uint64(m.State)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Query) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.DurationSeconds != 0 { - n += 9 - } - if len(m.Labels) > 0 { - for _, e := range m.Labels { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Annotations) > 0 { - for _, e := range m.Annotations { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Alerts) > 0 { - for _, e := range m.Alerts { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - l = len(m.Health) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.LastError) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.EvaluationDurationSeconds != 0 { - n += 9 - } - if m.LastEvaluationTime != 0 { - n += 1 + sovRpc(uint64(m.LastEvaluationTime)) - } - return n -} - -func (m *RecordingRule) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.Query) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.Labels) > 0 { - for _, e := range m.Labels { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - l = len(m.Health) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - l = len(m.LastError) - if l > 0 { - n += 1 + l + sovRpc(uint64(l)) - } - if m.EvaluationDurationSeconds != 0 { - n += 9 - } - if m.LastEvaluationTime != 0 { - n += 1 + sovRpc(uint64(m.LastEvaluationTime)) - } - return n -} - -func (m *RulesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovRpc(uint64(m.Type)) - } - return n -} - -func (m *RuleGroups) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Groups) > 0 { - for _, e := range m.Groups { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - return n -} - -func (m *RulesResponse) Size() (n int) { +func (m *RulesResponse) Size() (n int) { if m == nil { return 0 } @@ -3021,791 +2134,63 @@ func (m *RulesResponse) Size() (n int) { } func (m *RulesResponse_Group) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Group != nil { - l = m.Group.Size() - n += 1 + l + sovRpc(uint64(l)) - } - return n -} -func (m *RulesResponse_Warning) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Warning) - n += 1 + l + sovRpc(uint64(l)) - return n -} - -func sovRpc(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRpc(x uint64) (n int) { - return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *WriteResponse) Unmarshal(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 ErrIntOverflowRpc - } - 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: WriteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteRequest) Unmarshal(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 ErrIntOverflowRpc - } - 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: WriteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeseries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Timeseries = append(m.Timeseries, prompb.TimeSeries{}) - if err := m.Timeseries[len(m.Timeseries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tenant", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - 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 ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tenant = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Replica", wireType) - } - m.Replica = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Replica |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InfoRequest) Unmarshal(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 ErrIntOverflowRpc - } - 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: InfoRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InfoResponse) Unmarshal(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 ErrIntOverflowRpc - } - 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: InfoResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Labels = append(m.Labels, Label{}) - if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinTime", wireType) - } - m.MinTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTime", wireType) - } - m.MaxTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StoreType", wireType) - } - m.StoreType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StoreType |= StoreType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LabelSets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LabelSets = append(m.LabelSets, LabelSet{}) - if err := m.LabelSets[len(m.LabelSets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LabelSet) Unmarshal(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 ErrIntOverflowRpc - } - 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: LabelSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LabelSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Labels = append(m.Labels, Label{}) - if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SeriesRequest) Unmarshal(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 ErrIntOverflowRpc - } - 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: SeriesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SeriesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinTime", wireType) - } - m.MinTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTime", wireType) - } - m.MaxTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Matchers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Matchers = append(m.Matchers, LabelMatcher{}) - if err := m.Matchers[len(m.Matchers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxResolutionWindow", wireType) - } - m.MaxResolutionWindow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxResolutionWindow |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType == 0 { - var v Aggr - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Aggr(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Aggregates = append(m.Aggregates, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - if elementCount != 0 && len(m.Aggregates) == 0 { - m.Aggregates = make([]Aggr, 0, elementCount) - } - for iNdEx < postIndex { - var v Aggr - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Aggr(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Aggregates = append(m.Aggregates, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Aggregates", wireType) - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseDisabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PartialResponseDisabled = bool(v != 0) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) - } - m.PartialResponseStrategy = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift - if b < 0x80 { - break - } + if m == nil { + return 0 + } + var l int + _ = l + if m.Group != nil { + l = m.Group.Size() + n += 1 + l + sovRpc(uint64(l)) + } + return n +} +func (m *RulesResponse_Warning) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Warning) + n += 1 + l + sovRpc(uint64(l)) + return n +} + +func sovRpc(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRpc(x uint64) (n int) { + return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *WriteResponse) Unmarshal(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 ErrIntOverflowRpc } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SkipChunks", wireType) + if iNdEx >= l { + return io.ErrUnexpectedEOF } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.SkipChunks = bool(v != 0) + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WriteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -3830,7 +2215,7 @@ func (m *SeriesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *SeriesResponse) Unmarshal(dAtA []byte) error { +func (m *WriteRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3853,15 +2238,15 @@ func (m *SeriesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: SeriesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: WriteRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: SeriesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Series", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Timeseries", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3888,15 +2273,14 @@ func (m *SeriesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &Series{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Timeseries = append(m.Timeseries, prompb.TimeSeries{}) + if err := m.Timeseries[len(m.Timeseries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Result = &SeriesResponse_Series{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Warning", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tenant", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3924,8 +2308,27 @@ func (m *SeriesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = &SeriesResponse_Warning{string(dAtA[iNdEx:postIndex])} + m.Tenant = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Replica", wireType) + } + m.Replica = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Replica |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -3950,7 +2353,7 @@ func (m *SeriesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *LabelNamesRequest) Unmarshal(dAtA []byte) error { +func (m *InfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3973,51 +2376,12 @@ func (m *LabelNamesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: LabelNamesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: InfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: LabelNamesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseDisabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PartialResponseDisabled = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) - } - m.PartialResponseStrategy = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -4042,7 +2406,7 @@ func (m *LabelNamesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *LabelNamesResponse) Unmarshal(dAtA []byte) error { +func (m *InfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4065,17 +2429,17 @@ func (m *LabelNamesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: LabelNamesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: InfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: LabelNamesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4085,29 +2449,31 @@ func (m *LabelNamesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRpc } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRpc } if postIndex > l { return io.ErrUnexpectedEOF } - m.Names = append(m.Names, string(dAtA[iNdEx:postIndex])) + m.Labels = append(m.Labels, Label{}) + if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Warnings", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTime", wireType) } - var stringLen uint64 + m.MinTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4117,82 +2483,16 @@ func (m *LabelNamesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Warnings = append(m.Warnings, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LabelValuesRequest) Unmarshal(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 ErrIntOverflowRpc - } - 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: LabelValuesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LabelValuesRequest: 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) + m.MinTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - var stringLen uint64 + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxTime", wireType) + } + m.MaxTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4202,29 +2502,16 @@ func (m *LabelValuesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.MaxTime |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseDisabled", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StoreType", wireType) } - var v int + m.StoreType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4234,17 +2521,16 @@ func (m *LabelValuesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.StoreType |= StoreType(b&0x7F) << shift if b < 0x80 { break } } - m.PartialResponseDisabled = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LabelSets", wireType) } - m.PartialResponseStrategy = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4254,11 +2540,26 @@ func (m *LabelValuesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LabelSets = append(m.LabelSets, LabelSet{}) + if err := m.LabelSets[len(m.LabelSets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -4283,7 +2584,7 @@ func (m *LabelValuesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *LabelValuesResponse) Unmarshal(dAtA []byte) error { +func (m *LabelSet) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4306,17 +2607,17 @@ func (m *LabelValuesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: LabelValuesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: LabelSet: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: LabelValuesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LabelSet: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4326,55 +2627,25 @@ func (m *LabelValuesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRpc } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRpc } if postIndex > l { return io.ErrUnexpectedEOF } - m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Warnings", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - 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 ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF + m.Labels = append(m.Labels, Label{}) + if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Warnings = append(m.Warnings, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -4400,7 +2671,7 @@ func (m *LabelValuesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *RuleGroup) Unmarshal(dAtA []byte) error { +func (m *SeriesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4423,17 +2694,17 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RuleGroup: wiretype end group for non-group") + return fmt.Errorf("proto: SeriesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RuleGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SeriesRequest: 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) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTime", wireType) } - var stringLen uint64 + m.MinTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4443,29 +2714,16 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.MinTime |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - 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 File", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxTime", wireType) } - var stringLen uint64 + m.MaxTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4475,27 +2733,14 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.MaxTime |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.File = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Matchers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4522,27 +2767,124 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Rules = append(m.Rules, &Rule{}) - if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Matchers = append(m.Matchers, LabelMatcher{}) + if err := m.Matchers[len(m.Matchers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxResolutionWindow", wireType) } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF + m.MaxResolutionWindow = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxResolutionWindow |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType == 0 { + var v Aggr + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= Aggr(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Aggregates = append(m.Aggregates, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.Aggregates) == 0 { + m.Aggregates = make([]Aggr, 0, elementCount) + } + for iNdEx < postIndex { + var v Aggr + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= Aggr(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Aggregates = append(m.Aggregates, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Aggregates", wireType) + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseDisabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.Interval = float64(math.Float64frombits(v)) - case 5: + m.PartialResponseDisabled = bool(v != 0) + case 7: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EvaluationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) } - m.EvaluationTime = 0 + m.PartialResponseStrategy = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4552,16 +2894,16 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EvaluationTime |= int64(b&0x7F) << shift + m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift if b < 0x80 { break } } - case 6: + case 8: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastEvaluationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SkipChunks", wireType) } - m.LastEvaluationTime = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4571,11 +2913,12 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LastEvaluationTime |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.SkipChunks = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -4600,7 +2943,7 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *Rule) Unmarshal(dAtA []byte) error { +func (m *SeriesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4623,15 +2966,15 @@ func (m *Rule) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Rule: wiretype end group for non-group") + return fmt.Errorf("proto: SeriesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Rule: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SeriesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecordingRule", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Series", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4658,17 +3001,17 @@ func (m *Rule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &RecordingRule{} + v := &Series{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Result = &Rule_RecordingRule{v} + m.Result = &SeriesResponse_Series{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Warning", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4678,26 +3021,23 @@ func (m *Rule) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRpc } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRpc } if postIndex > l { return io.ErrUnexpectedEOF } - v := &Alert{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Result = &Rule_Alert{v} + m.Result = &SeriesResponse_Warning{string(dAtA[iNdEx:postIndex])} iNdEx = postIndex default: iNdEx = preIndex @@ -4723,7 +3063,7 @@ func (m *Rule) Unmarshal(dAtA []byte) error { } return nil } -func (m *Alert) Unmarshal(dAtA []byte) error { +func (m *LabelNamesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4736,255 +3076,27 @@ func (m *Alert) Unmarshal(dAtA []byte) error { 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: Alert: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Alert: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= Alert_State(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - 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 ErrIntOverflowRpc - } - 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 ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - 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 ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Query = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field DurationSeconds", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.DurationSeconds = float64(math.Float64frombits(v)) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Labels = append(m.Labels, &Label{}) - if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Annotations = append(m.Annotations, &Label{}) - if err := m.Annotations[len(m.Annotations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alerts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Alerts = append(m.Alerts, &Alert{}) - if err := m.Alerts[len(m.Alerts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - 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 ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Health = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastError", wireType) + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - var stringLen uint64 + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LabelNamesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LabelNamesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseDisabled", wireType) + } + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -4994,40 +3106,17 @@ func (m *Alert) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LastError = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field EvaluationDurationSeconds", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.EvaluationDurationSeconds = float64(math.Float64frombits(v)) - case 11: + m.PartialResponseDisabled = bool(v != 0) + case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastEvaluationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) } - m.LastEvaluationTime = 0 + m.PartialResponseStrategy = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -5037,7 +3126,7 @@ func (m *Alert) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LastEvaluationTime |= int64(b&0x7F) << shift + m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift if b < 0x80 { break } @@ -5066,7 +3155,7 @@ func (m *Alert) Unmarshal(dAtA []byte) error { } return nil } -func (m *RecordingRule) Unmarshal(dAtA []byte) error { +func (m *LabelNamesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5089,15 +3178,15 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RecordingRule: wiretype end group for non-group") + return fmt.Errorf("proto: LabelNamesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RecordingRule: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LabelNamesResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5125,11 +3214,11 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Names = append(m.Names, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Warnings", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5157,45 +3246,64 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Query = string(dAtA[iNdEx:postIndex]) + m.Warnings = append(m.Warnings, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipRpc(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if skippy < 0 { return ErrInvalidLengthRpc } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (iNdEx + skippy) < 0 { return ErrInvalidLengthRpc } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Labels = append(m.Labels, &Label{}) - if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LabelValuesRequest) Unmarshal(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 ErrIntOverflowRpc } - iNdEx = postIndex - case 4: + 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: LabelValuesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LabelValuesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5223,13 +3331,13 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Health = string(dAtA[iNdEx:postIndex]) + m.Label = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastError", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseDisabled", wireType) } - var stringLen uint64 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -5239,40 +3347,17 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LastError = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field EvaluationDurationSeconds", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - m.EvaluationDurationSeconds = float64(math.Float64frombits(v)) - case 7: + m.PartialResponseDisabled = bool(v != 0) + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastEvaluationTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) } - m.LastEvaluationTime = 0 + m.PartialResponseStrategy = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -5282,7 +3367,7 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LastEvaluationTime |= int64(b&0x7F) << shift + m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift if b < 0x80 { break } @@ -5311,7 +3396,7 @@ func (m *RecordingRule) Unmarshal(dAtA []byte) error { } return nil } -func (m *RulesRequest) Unmarshal(dAtA []byte) error { +func (m *LabelValuesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5334,17 +3419,17 @@ func (m *RulesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RulesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: LabelValuesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RulesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LabelValuesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } - m.Type = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -5354,11 +3439,56 @@ func (m *RulesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= RulesRequest_Type(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Warnings", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + 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 ErrInvalidLengthRpc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Warnings = append(m.Warnings, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -5383,7 +3513,7 @@ func (m *RulesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *RuleGroups) Unmarshal(dAtA []byte) error { +func (m *RulesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5406,17 +3536,17 @@ func (m *RuleGroups) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RuleGroups: wiretype end group for non-group") + return fmt.Errorf("proto: RulesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RuleGroups: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RulesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } - var msglen int + m.Type = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRpc @@ -5426,26 +3556,30 @@ func (m *RuleGroups) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Type |= RulesRequest_Type(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) } - m.Groups = append(m.Groups, &RuleGroup{}) - if err := m.Groups[len(m.Groups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.PartialResponseStrategy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) diff --git a/pkg/store/storepb/rpc.proto b/pkg/store/storepb/rpc.proto index e1c598232e..3298a4f33e 100644 --- a/pkg/store/storepb/rpc.proto +++ b/pkg/store/storepb/rpc.proto @@ -5,6 +5,7 @@ syntax = "proto3"; package thanos; import "types.proto"; +import "rules.proto"; import "gogoproto/gogo.proto"; import "github.com/prometheus/prometheus/prompb/types.proto"; @@ -83,20 +84,6 @@ message LabelSet { repeated Label labels = 1 [(gogoproto.nullable) = false]; } -/// PartialResponseStrategy controls partial response handling. -enum PartialResponseStrategy { - /// WARN strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying - /// storeAPI is temporarily not available) as warning which will not fail the whole query (still OK response). - /// Server should produce those as a warnings field in response. - WARN = 0; - /// ABORT strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying - /// storeAPI is temporarily not available) as the gRPC error that aborts the query. - /// - /// This is especially useful for any rule/alert evaluations on top of StoreAPI which usually does not tolerate partial - /// errors. - ABORT = 1; -} - message SeriesRequest { int64 min_time = 1; int64 max_time = 2; @@ -142,7 +129,7 @@ message LabelNamesRequest { } message LabelNamesResponse { - repeated string names = 1; + repeated string names = 1; repeated string warnings = 2; } @@ -156,7 +143,7 @@ message LabelValuesRequest { } message LabelValuesResponse { - repeated string values = 1; + repeated string values = 1; repeated string warnings = 2; } @@ -166,67 +153,14 @@ service Rules { rpc Rules(RulesRequest) returns (stream RulesResponse); } -/// RuleGroup has info for rules which are part of a group. -message RuleGroup { - string name = 1; - string file = 2; - // In order to preserve rule ordering, while exposing type (alerting or recording) - // specific properties, both alerting and recording rules are exposed in the - // same array. - repeated Rule rules = 3; - double interval = 4; - int64 evaluation_time = 5; - int64 last_evaluation_time = 6; -} - -message Rule { - oneof result { - RecordingRule recording_rule = 1; - Alert alert= 2; - } -} - -message Alert { - enum State { - PENDING = 0; - FIRING = 1; - INACTIVE = 2; - } - - State state = 1; - string name = 2; - string query = 3; - double duration_seconds = 4; // Is it second? - repeated Label labels = 5; - repeated Label annotations = 6; - repeated Alert alerts = 7; - string health = 8; - string last_error = 9; - double evaluation_duration_seconds = 10; // Is it second? - int64 last_evaluation_time = 11; -} - -message RecordingRule { - string name = 1; - string query = 2; - repeated Label labels = 3; - string health = 4; - string last_error = 5; - double evaluation_duration_seconds = 6; // Is it second? - int64 last_evaluation_time = 7; -} - message RulesRequest { enum Type { - ALL = 0; - ALERTING = 1; - RECORDING = 2; + ALL = 0; + ALERTING = 1; + RECORDING = 2; } Type type = 1; -} - -message RuleGroups { - repeated RuleGroup groups = 1; + PartialResponseStrategy partial_response_strategy = 2; } message RulesResponse { diff --git a/pkg/store/storepb/rules.pb.go b/pkg/store/storepb/rules.pb.go new file mode 100644 index 0000000000..a590aa74d0 --- /dev/null +++ b/pkg/store/storepb/rules.pb.go @@ -0,0 +1,2693 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rules.proto + +package storepb + +import ( + encoding_binary "encoding/binary" + fmt "fmt" + + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +/// AlertState represents state of the alert. Has to match 1:1 Prometheus AlertState: +// +// StateInactive is the state of an alert that is neither firing nor pending. +//StateInactive AlertState = iota +// StatePending is the state of an alert that has been active for less than +// the configured threshold duration. +//StatePending +// StateFiring is the state of an alert that has been active for longer than +// the configured threshold duration. +//StateFiring +type AlertState int32 + +const ( + AlertState_INACTIVE AlertState = 0 + AlertState_PENDING AlertState = 1 + AlertState_FIRING AlertState = 2 +) + +var AlertState_name = map[int32]string{ + 0: "INACTIVE", + 1: "PENDING", + 2: "FIRING", +} + +var AlertState_value = map[string]int32{ + "INACTIVE": 0, + "PENDING": 1, + "FIRING": 2, +} + +func (x AlertState) String() string { + return proto.EnumName(AlertState_name, int32(x)) +} + +func (AlertState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{0} +} + +/// RuleGroups is set of rule groups. +/// This and below APIs are meant to be used for unmarshaling and marshsaling rules from/to Prometheus API. +/// That's why json tag has to be customized and matching https://github.com/prometheus/prometheus/blob/c530b4b456cc5f9ec249f771dff187eb7715dc9b/web/api/v1/api.go#L955 +/// NOTE: See rules_custom_test.go for compatibility tests. +/// +/// For rule parsing from YAML configuration other struct is used: https://github.com/prometheus/prometheus/blob/20b1f596f6fb16107ef0c244d240b0ad6da36829/pkg/rulefmt/rulefmt.go#L105 +/// TODO(bwplotka): Replace Thanos Rule JSON API Rules structs with this. +type RuleGroups struct { + Groups []*RuleGroup `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups"` +} + +func (m *RuleGroups) Reset() { *m = RuleGroups{} } +func (m *RuleGroups) String() string { return proto.CompactTextString(m) } +func (*RuleGroups) ProtoMessage() {} +func (*RuleGroups) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{0} +} +func (m *RuleGroups) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RuleGroups) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RuleGroups.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RuleGroups) XXX_Merge(src proto.Message) { + xxx_messageInfo_RuleGroups.Merge(m, src) +} +func (m *RuleGroups) XXX_Size() int { + return m.Size() +} +func (m *RuleGroups) XXX_DiscardUnknown() { + xxx_messageInfo_RuleGroups.DiscardUnknown(m) +} + +var xxx_messageInfo_RuleGroups proto.InternalMessageInfo + +/// RuleGroup has info for rules which are part of a group. +type RuleGroup struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` + File string `protobuf:"bytes,2,opt,name=file,proto3" json:"file"` + Rules []*Rule `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules"` + Interval float64 `protobuf:"fixed64,4,opt,name=interval,proto3" json:"interval"` + EvaluationDurationSeconds float64 `protobuf:"fixed64,5,opt,name=evaluation_duration_seconds,json=evaluationDurationSeconds,proto3" json:"evaluationTime"` + LastEvaluation time.Time `protobuf:"bytes,6,opt,name=last_evaluation,json=lastEvaluation,proto3,stdtime" json:"lastEvaluation"` + // Thanos specific. + DeprecatedPartialResponseStrategy PartialResponseStrategy `protobuf:"varint,7,opt,name=DeprecatedPartialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partial_response_strategy"` + PartialResponseStrategy PartialResponseStrategy `protobuf:"varint,8,opt,name=PartialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partialResponseStrategy"` +} + +func (m *RuleGroup) Reset() { *m = RuleGroup{} } +func (m *RuleGroup) String() string { return proto.CompactTextString(m) } +func (*RuleGroup) ProtoMessage() {} +func (*RuleGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{1} +} +func (m *RuleGroup) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RuleGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RuleGroup.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RuleGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_RuleGroup.Merge(m, src) +} +func (m *RuleGroup) XXX_Size() int { + return m.Size() +} +func (m *RuleGroup) XXX_DiscardUnknown() { + xxx_messageInfo_RuleGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_RuleGroup proto.InternalMessageInfo + +type Rule struct { + // Types that are valid to be assigned to Result: + // *Rule_Recording + // *Rule_Alert + Result isRule_Result `protobuf_oneof:"result"` +} + +func (m *Rule) Reset() { *m = Rule{} } +func (m *Rule) String() string { return proto.CompactTextString(m) } +func (*Rule) ProtoMessage() {} +func (*Rule) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{2} +} +func (m *Rule) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rule.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Rule) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rule.Merge(m, src) +} +func (m *Rule) XXX_Size() int { + return m.Size() +} +func (m *Rule) XXX_DiscardUnknown() { + xxx_messageInfo_Rule.DiscardUnknown(m) +} + +var xxx_messageInfo_Rule proto.InternalMessageInfo + +type isRule_Result interface { + isRule_Result() + MarshalTo([]byte) (int, error) + Size() int +} + +type Rule_Recording struct { + Recording *RecordingRule `protobuf:"bytes,1,opt,name=recording,proto3,oneof" json:"recording,omitempty"` +} +type Rule_Alert struct { + Alert *Alert `protobuf:"bytes,2,opt,name=alert,proto3,oneof" json:"alert,omitempty"` +} + +func (*Rule_Recording) isRule_Result() {} +func (*Rule_Alert) isRule_Result() {} + +func (m *Rule) GetResult() isRule_Result { + if m != nil { + return m.Result + } + return nil +} + +func (m *Rule) GetRecording() *RecordingRule { + if x, ok := m.GetResult().(*Rule_Recording); ok { + return x.Recording + } + return nil +} + +func (m *Rule) GetAlert() *Alert { + if x, ok := m.GetResult().(*Rule_Alert); ok { + return x.Alert + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Rule) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Rule_Recording)(nil), + (*Rule_Alert)(nil), + } +} + +type AlertInstance struct { + Labels *PromLabels `protobuf:"bytes,1,opt,name=labels,proto3" json:"labels"` + Annotations *PromLabels `protobuf:"bytes,2,opt,name=annotations,proto3" json:"annotations"` + State AlertState `protobuf:"varint,3,opt,name=state,proto3,enum=thanos.AlertState" json:"state"` + ActiveAt *time.Time `protobuf:"bytes,4,opt,name=active_at,json=activeAt,proto3,stdtime" json:"activeAt,omitempty"` + Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value"` + // Thanos specific. Used mainly for alert API purposes. + PartialResponseStrategy PartialResponseStrategy `protobuf:"varint,6,opt,name=PartialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partialResponseStrategy"` +} + +func (m *AlertInstance) Reset() { *m = AlertInstance{} } +func (m *AlertInstance) String() string { return proto.CompactTextString(m) } +func (*AlertInstance) ProtoMessage() {} +func (*AlertInstance) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{3} +} +func (m *AlertInstance) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlertInstance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AlertInstance.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AlertInstance) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlertInstance.Merge(m, src) +} +func (m *AlertInstance) XXX_Size() int { + return m.Size() +} +func (m *AlertInstance) XXX_DiscardUnknown() { + xxx_messageInfo_AlertInstance.DiscardUnknown(m) +} + +var xxx_messageInfo_AlertInstance proto.InternalMessageInfo + +type Alert struct { + State AlertState `protobuf:"varint,1,opt,name=state,proto3,enum=thanos.AlertState" json:"state"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` + Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query"` + DurationSeconds float64 `protobuf:"fixed64,4,opt,name=duration_seconds,json=durationSeconds,proto3" json:"duration"` + Labels *PromLabels `protobuf:"bytes,5,opt,name=labels,proto3" json:"labels"` + Annotations *PromLabels `protobuf:"bytes,6,opt,name=annotations,proto3" json:"annotations"` + Alerts []*AlertInstance `protobuf:"bytes,7,rep,name=alerts,proto3" json:"alerts"` + Health string `protobuf:"bytes,8,opt,name=health,proto3" json:"health"` + LastError string `protobuf:"bytes,9,opt,name=last_error,json=lastError,proto3" json:"lastError,omitempty"` + EvaluationDurationSeconds float64 `protobuf:"fixed64,10,opt,name=evaluation_duration_seconds,json=evaluationDurationSeconds,proto3" json:"evaluationTime"` + LastEvaluation time.Time `protobuf:"bytes,11,opt,name=last_evaluation,json=lastEvaluation,proto3,stdtime" json:"lastEvaluation"` +} + +func (m *Alert) Reset() { *m = Alert{} } +func (m *Alert) String() string { return proto.CompactTextString(m) } +func (*Alert) ProtoMessage() {} +func (*Alert) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{4} +} +func (m *Alert) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Alert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Alert.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Alert) XXX_Merge(src proto.Message) { + xxx_messageInfo_Alert.Merge(m, src) +} +func (m *Alert) XXX_Size() int { + return m.Size() +} +func (m *Alert) XXX_DiscardUnknown() { + xxx_messageInfo_Alert.DiscardUnknown(m) +} + +var xxx_messageInfo_Alert proto.InternalMessageInfo + +type RecordingRule struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` + Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query"` + Labels *PromLabels `protobuf:"bytes,3,opt,name=labels,proto3" json:"labels"` + Health string `protobuf:"bytes,4,opt,name=health,proto3" json:"health"` + LastError string `protobuf:"bytes,5,opt,name=last_error,json=lastError,proto3" json:"lastError,omitempty"` + EvaluationDurationSeconds float64 `protobuf:"fixed64,6,opt,name=evaluation_duration_seconds,json=evaluationDurationSeconds,proto3" json:"evaluationTime"` + LastEvaluation time.Time `protobuf:"bytes,7,opt,name=last_evaluation,json=lastEvaluation,proto3,stdtime" json:"lastEvaluation"` +} + +func (m *RecordingRule) Reset() { *m = RecordingRule{} } +func (m *RecordingRule) String() string { return proto.CompactTextString(m) } +func (*RecordingRule) ProtoMessage() {} +func (*RecordingRule) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{5} +} +func (m *RecordingRule) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RecordingRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RecordingRule.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RecordingRule) XXX_Merge(src proto.Message) { + xxx_messageInfo_RecordingRule.Merge(m, src) +} +func (m *RecordingRule) XXX_Size() int { + return m.Size() +} +func (m *RecordingRule) XXX_DiscardUnknown() { + xxx_messageInfo_RecordingRule.DiscardUnknown(m) +} + +var xxx_messageInfo_RecordingRule proto.InternalMessageInfo + +type PromLabels struct { + Labels []Label `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels"` +} + +func (m *PromLabels) Reset() { *m = PromLabels{} } +func (m *PromLabels) String() string { return proto.CompactTextString(m) } +func (*PromLabels) ProtoMessage() {} +func (*PromLabels) Descriptor() ([]byte, []int) { + return fileDescriptor_8e722d3e922f0937, []int{6} +} +func (m *PromLabels) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PromLabels) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PromLabels.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PromLabels) XXX_Merge(src proto.Message) { + xxx_messageInfo_PromLabels.Merge(m, src) +} +func (m *PromLabels) XXX_Size() int { + return m.Size() +} +func (m *PromLabels) XXX_DiscardUnknown() { + xxx_messageInfo_PromLabels.DiscardUnknown(m) +} + +var xxx_messageInfo_PromLabels proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("thanos.AlertState", AlertState_name, AlertState_value) + proto.RegisterType((*RuleGroups)(nil), "thanos.RuleGroups") + proto.RegisterType((*RuleGroup)(nil), "thanos.RuleGroup") + proto.RegisterType((*Rule)(nil), "thanos.Rule") + proto.RegisterType((*AlertInstance)(nil), "thanos.AlertInstance") + proto.RegisterType((*Alert)(nil), "thanos.Alert") + proto.RegisterType((*RecordingRule)(nil), "thanos.RecordingRule") + proto.RegisterType((*PromLabels)(nil), "thanos.PromLabels") +} + +func init() { proto.RegisterFile("rules.proto", fileDescriptor_8e722d3e922f0937) } + +var fileDescriptor_8e722d3e922f0937 = []byte{ + // 880 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4d, 0x6f, 0xdb, 0x36, + 0x18, 0xb6, 0x62, 0x4b, 0xb6, 0x5e, 0x25, 0x4d, 0xc6, 0xad, 0x88, 0x9a, 0x6e, 0x96, 0x67, 0xa0, + 0x80, 0xb1, 0x0f, 0x07, 0x70, 0xd0, 0x0e, 0x3d, 0x46, 0x4d, 0xd6, 0x1a, 0x18, 0x82, 0x82, 0x09, + 0x76, 0xd8, 0xc5, 0x60, 0x6c, 0xd6, 0x11, 0x20, 0x8b, 0x1a, 0x49, 0x07, 0xc8, 0x7f, 0xd8, 0xa1, + 0xb7, 0xfd, 0x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 0xa0, 0x75, 0x68, 0x0d, 0x8f, 0xf6, 0x9f, + 0x9d, 0x0c, 0xbf, 0x3f, 0xdc, 0xaa, 0x21, 0x07, 0x9a, 0x2f, 0x0f, 0x8f, 0x0e, 0x86, 0x47, 0xcf, + 0xb7, 0x0c, 0x04, 0x60, 0x7d, 0x3b, 0xc4, 0xd9, 0x78, 0xcd, 0x7f, 0x74, 0xf9, 0x67, 0xbb, 0x76, + 0x79, 0xd5, 0x36, 0xde, 0x5c, 0xb5, 0x8d, 0x3f, 0xae, 0xda, 0xc6, 0xeb, 0xeb, 0x76, 0xed, 0xcd, + 0x75, 0xbb, 0xf6, 0xeb, 0x75, 0xbb, 0xf6, 0x43, 0x53, 0x48, 0xc6, 0x69, 0x7c, 0x7a, 0x6a, 0xa9, + 0x63, 0xed, 0xfd, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x9e, 0x97, 0xda, 0xdc, 0x09, 0x00, 0x00, +} + +func (m *RuleGroups) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuleGroups) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RuleGroups) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Groups) > 0 { + for iNdEx := len(m.Groups) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Groups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *RuleGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuleGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RuleGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PartialResponseStrategy != 0 { + i = encodeVarintRules(dAtA, i, uint64(m.PartialResponseStrategy)) + i-- + dAtA[i] = 0x40 + } + if m.DeprecatedPartialResponseStrategy != 0 { + i = encodeVarintRules(dAtA, i, uint64(m.DeprecatedPartialResponseStrategy)) + i-- + dAtA[i] = 0x38 + } + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastEvaluation, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintRules(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x32 + if m.EvaluationDurationSeconds != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.EvaluationDurationSeconds)))) + i-- + dAtA[i] = 0x29 + } + if m.Interval != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Interval)))) + i-- + dAtA[i] = 0x21 + } + if len(m.Rules) > 0 { + for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.File) > 0 { + i -= len(m.File) + copy(dAtA[i:], m.File) + i = encodeVarintRules(dAtA, i, uint64(len(m.File))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Rule) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Rule) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rule) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Result != nil { + { + size := m.Result.Size() + i -= size + if _, err := m.Result.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Rule_Recording) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rule_Recording) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Recording != nil { + { + size, err := m.Recording.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *Rule_Alert) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rule_Alert) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Alert != nil { + { + size, err := m.Alert.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *AlertInstance) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlertInstance) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AlertInstance) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PartialResponseStrategy != 0 { + i = encodeVarintRules(dAtA, i, uint64(m.PartialResponseStrategy)) + i-- + dAtA[i] = 0x30 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintRules(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x2a + } + if m.ActiveAt != nil { + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.ActiveAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.ActiveAt):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintRules(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x22 + } + if m.State != 0 { + i = encodeVarintRules(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x18 + } + if m.Annotations != nil { + { + size, err := m.Annotations.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Labels != nil { + { + size, err := m.Labels.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Alert) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Alert) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Alert) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastEvaluation, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintRules(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x5a + if m.EvaluationDurationSeconds != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.EvaluationDurationSeconds)))) + i-- + dAtA[i] = 0x51 + } + if len(m.LastError) > 0 { + i -= len(m.LastError) + copy(dAtA[i:], m.LastError) + i = encodeVarintRules(dAtA, i, uint64(len(m.LastError))) + i-- + dAtA[i] = 0x4a + } + if len(m.Health) > 0 { + i -= len(m.Health) + copy(dAtA[i:], m.Health) + i = encodeVarintRules(dAtA, i, uint64(len(m.Health))) + i-- + dAtA[i] = 0x42 + } + if len(m.Alerts) > 0 { + for iNdEx := len(m.Alerts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Alerts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if m.Annotations != nil { + { + size, err := m.Annotations.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.Labels != nil { + { + size, err := m.Labels.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.DurationSeconds != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.DurationSeconds)))) + i-- + dAtA[i] = 0x21 + } + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintRules(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.State != 0 { + i = encodeVarintRules(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RecordingRule) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RecordingRule) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RecordingRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastEvaluation, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintRules(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x3a + if m.EvaluationDurationSeconds != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.EvaluationDurationSeconds)))) + i-- + dAtA[i] = 0x31 + } + if len(m.LastError) > 0 { + i -= len(m.LastError) + copy(dAtA[i:], m.LastError) + i = encodeVarintRules(dAtA, i, uint64(len(m.LastError))) + i-- + dAtA[i] = 0x2a + } + if len(m.Health) > 0 { + i -= len(m.Health) + copy(dAtA[i:], m.Health) + i = encodeVarintRules(dAtA, i, uint64(len(m.Health))) + i-- + dAtA[i] = 0x22 + } + if m.Labels != nil { + { + size, err := m.Labels.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintRules(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRules(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PromLabels) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PromLabels) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PromLabels) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Labels) > 0 { + for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Labels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRules(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintRules(dAtA []byte, offset int, v uint64) int { + offset -= sovRules(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RuleGroups) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Groups) > 0 { + for _, e := range m.Groups { + l = e.Size() + n += 1 + l + sovRules(uint64(l)) + } + } + return n +} + +func (m *RuleGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.File) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovRules(uint64(l)) + } + } + if m.Interval != 0 { + n += 9 + } + if m.EvaluationDurationSeconds != 0 { + n += 9 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation) + n += 1 + l + sovRules(uint64(l)) + if m.DeprecatedPartialResponseStrategy != 0 { + n += 1 + sovRules(uint64(m.DeprecatedPartialResponseStrategy)) + } + if m.PartialResponseStrategy != 0 { + n += 1 + sovRules(uint64(m.PartialResponseStrategy)) + } + return n +} + +func (m *Rule) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != nil { + n += m.Result.Size() + } + return n +} + +func (m *Rule_Recording) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Recording != nil { + l = m.Recording.Size() + n += 1 + l + sovRules(uint64(l)) + } + return n +} +func (m *Rule_Alert) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Alert != nil { + l = m.Alert.Size() + n += 1 + l + sovRules(uint64(l)) + } + return n +} +func (m *AlertInstance) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Labels != nil { + l = m.Labels.Size() + n += 1 + l + sovRules(uint64(l)) + } + if m.Annotations != nil { + l = m.Annotations.Size() + n += 1 + l + sovRules(uint64(l)) + } + if m.State != 0 { + n += 1 + sovRules(uint64(m.State)) + } + if m.ActiveAt != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.ActiveAt) + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + if m.PartialResponseStrategy != 0 { + n += 1 + sovRules(uint64(m.PartialResponseStrategy)) + } + return n +} + +func (m *Alert) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.State != 0 { + n += 1 + sovRules(uint64(m.State)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.Query) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + if m.DurationSeconds != 0 { + n += 9 + } + if m.Labels != nil { + l = m.Labels.Size() + n += 1 + l + sovRules(uint64(l)) + } + if m.Annotations != nil { + l = m.Annotations.Size() + n += 1 + l + sovRules(uint64(l)) + } + if len(m.Alerts) > 0 { + for _, e := range m.Alerts { + l = e.Size() + n += 1 + l + sovRules(uint64(l)) + } + } + l = len(m.Health) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.LastError) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + if m.EvaluationDurationSeconds != 0 { + n += 9 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation) + n += 1 + l + sovRules(uint64(l)) + return n +} + +func (m *RecordingRule) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.Query) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + if m.Labels != nil { + l = m.Labels.Size() + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.Health) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + l = len(m.LastError) + if l > 0 { + n += 1 + l + sovRules(uint64(l)) + } + if m.EvaluationDurationSeconds != 0 { + n += 9 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation) + n += 1 + l + sovRules(uint64(l)) + return n +} + +func (m *PromLabels) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Labels) > 0 { + for _, e := range m.Labels { + l = e.Size() + n += 1 + l + sovRules(uint64(l)) + } + } + return n +} + +func sovRules(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRules(x uint64) (n int) { + return sovRules(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RuleGroups) Unmarshal(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 ErrIntOverflowRules + } + 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: RuleGroups: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuleGroups: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Groups = append(m.Groups, &RuleGroup{}) + if err := m.Groups[len(m.Groups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuleGroup) Unmarshal(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 ErrIntOverflowRules + } + 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: RuleGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuleGroup: 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 ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + 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 File", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.File = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rules = append(m.Rules, &Rule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Interval = float64(math.Float64frombits(v)) + case 5: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field EvaluationDurationSeconds", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.EvaluationDurationSeconds = float64(math.Float64frombits(v)) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastEvaluation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.LastEvaluation, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedPartialResponseStrategy", wireType) + } + m.DeprecatedPartialResponseStrategy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DeprecatedPartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) + } + m.PartialResponseStrategy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Rule) Unmarshal(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 ErrIntOverflowRules + } + 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: Rule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recording", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RecordingRule{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Result = &Rule_Recording{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Alert{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Result = &Rule_Alert{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlertInstance) Unmarshal(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 ErrIntOverflowRules + } + 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: AlertInstance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlertInstance: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Labels == nil { + m.Labels = &PromLabels{} + } + if err := m.Labels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Annotations == nil { + m.Annotations = &PromLabels{} + } + if err := m.Annotations.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= AlertState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ActiveAt == nil { + m.ActiveAt = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.ActiveAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + 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 ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) + } + m.PartialResponseStrategy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PartialResponseStrategy |= PartialResponseStrategy(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Alert) Unmarshal(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 ErrIntOverflowRules + } + 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: Alert: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Alert: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= AlertState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + 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 ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field DurationSeconds", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.DurationSeconds = float64(math.Float64frombits(v)) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Labels == nil { + m.Labels = &PromLabels{} + } + if err := m.Labels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Annotations == nil { + m.Annotations = &PromLabels{} + } + if err := m.Annotations.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Alerts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Alerts = append(m.Alerts, &AlertInstance{}) + if err := m.Alerts[len(m.Alerts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Health = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field EvaluationDurationSeconds", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.EvaluationDurationSeconds = float64(math.Float64frombits(v)) + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastEvaluation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.LastEvaluation, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RecordingRule) Unmarshal(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 ErrIntOverflowRules + } + 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: RecordingRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RecordingRule: 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 ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + 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 Query", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Labels == nil { + m.Labels = &PromLabels{} + } + if err := m.Labels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Health = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + 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 ErrInvalidLengthRules + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field EvaluationDurationSeconds", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.EvaluationDurationSeconds = float64(math.Float64frombits(v)) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastEvaluation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.LastEvaluation, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PromLabels) Unmarshal(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 ErrIntOverflowRules + } + 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: PromLabels: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PromLabels: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRules + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRules + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRules + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Labels = append(m.Labels, Label{}) + if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRules(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRules + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRules(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRules + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRules + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRules + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRules + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRules + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRules + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRules = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRules = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRules = fmt.Errorf("proto: unexpected end of group") +) diff --git a/pkg/store/storepb/rules.proto b/pkg/store/storepb/rules.proto new file mode 100644 index 0000000000..24277108e5 --- /dev/null +++ b/pkg/store/storepb/rules.proto @@ -0,0 +1,109 @@ +// Copyright (c) The Thanos Authors. +// Licensed under the Apache License 2.0. + +syntax = "proto3"; +package thanos; + +import "types.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "storepb"; + +option (gogoproto.sizer_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.goproto_getters_all) = false; + +// Do not generate XXX fields to reduce memory footprint and opening a door +// for zero-copy casts to/from prometheus data types. +option (gogoproto.goproto_unkeyed_all) = false; +option (gogoproto.goproto_unrecognized_all) = false; +option (gogoproto.goproto_sizecache_all) = false; + +/// RuleGroups is set of rule groups. +/// This and below APIs are meant to be used for unmarshaling and marshsaling rules from/to Prometheus API. +/// That's why json tag has to be customized and matching https://github.com/prometheus/prometheus/blob/c530b4b456cc5f9ec249f771dff187eb7715dc9b/web/api/v1/api.go#L955 +/// NOTE: See rules_custom_test.go for compatibility tests. +/// +/// For rule parsing from YAML configuration other struct is used: https://github.com/prometheus/prometheus/blob/20b1f596f6fb16107ef0c244d240b0ad6da36829/pkg/rulefmt/rulefmt.go#L105 +/// TODO(bwplotka): Replace Thanos Rule JSON API Rules structs with this. +message RuleGroups { + repeated RuleGroup groups = 1 [(gogoproto.jsontag) = "groups" ]; +} + +/// RuleGroup has info for rules which are part of a group. +message RuleGroup { + string name = 1 [(gogoproto.jsontag) = "name" ]; + string file = 2 [(gogoproto.jsontag) = "file" ]; + repeated Rule rules = 3 [(gogoproto.jsontag) = "rules" ]; + double interval = 4 [(gogoproto.jsontag) = "interval" ]; + double evaluation_duration_seconds = 5 [(gogoproto.jsontag) = "evaluationTime" ]; // TODO: Is it really second? + google.protobuf.Timestamp last_evaluation = 6 [(gogoproto.jsontag) = "lastEvaluation", (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; + + // Thanos specific. + PartialResponseStrategy DeprecatedPartialResponseStrategy = 7 [(gogoproto.jsontag) = "partial_response_strategy"]; + PartialResponseStrategy PartialResponseStrategy = 8 [(gogoproto.jsontag) = "partialResponseStrategy" ]; +} + +message Rule { + oneof result { + RecordingRule recording = 1; + Alert alert= 2; + } +} + +/// AlertState represents state of the alert. Has to match 1:1 Prometheus AlertState: +// +// StateInactive is the state of an alert that is neither firing nor pending. +//StateInactive AlertState = iota +// StatePending is the state of an alert that has been active for less than +// the configured threshold duration. +//StatePending +// StateFiring is the state of an alert that has been active for longer than +// the configured threshold duration. +//StateFiring +enum AlertState { + INACTIVE = 0; + PENDING = 1; + FIRING = 2; +} + +message AlertInstance { + PromLabels labels = 1 [(gogoproto.jsontag) = "labels" ]; + PromLabels annotations = 2 [(gogoproto.jsontag) = "annotations" ]; + AlertState state = 3 [(gogoproto.jsontag) = "state" ]; + google.protobuf.Timestamp active_at = 4 [(gogoproto.jsontag) = "activeAt,omitempty", (gogoproto.stdtime) = true]; + string value = 5 [(gogoproto.jsontag) = "value" ]; + + // Thanos specific. Used mainly for alert API purposes. + PartialResponseStrategy PartialResponseStrategy = 6 [(gogoproto.jsontag) = "partialResponseStrategy" ]; +} + +message Alert { + AlertState state = 1 [(gogoproto.jsontag) = "state" ]; + string name = 2 [(gogoproto.jsontag) = "name" ]; + string query = 3 [(gogoproto.jsontag) = "query" ]; + double duration_seconds = 4 [(gogoproto.jsontag) = "duration" ]; + PromLabels labels = 5 [(gogoproto.jsontag) = "labels" ]; + PromLabels annotations = 6 [(gogoproto.jsontag) = "annotations" ]; + repeated AlertInstance alerts = 7 [(gogoproto.jsontag) = "alerts" ]; + string health = 8 [(gogoproto.jsontag) = "health" ]; + string last_error = 9 [(gogoproto.jsontag) = "lastError,omitempty" ]; + double evaluation_duration_seconds = 10 [(gogoproto.jsontag) = "evaluationTime" ]; + google.protobuf.Timestamp last_evaluation = 11 [(gogoproto.jsontag) = "lastEvaluation", (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; +} + +message RecordingRule { + string name = 1 [(gogoproto.jsontag) = "name" ]; + string query = 2 [(gogoproto.jsontag) = "query" ]; + PromLabels labels = 3 [(gogoproto.jsontag) = "labels" ]; + string health = 4 [(gogoproto.jsontag) = "health" ]; + string last_error = 5 [(gogoproto.jsontag) = "lastError,omitempty" ]; + double evaluation_duration_seconds = 6 [(gogoproto.jsontag) = "evaluationTime" ]; + google.protobuf.Timestamp last_evaluation = 7 [(gogoproto.jsontag) = "lastEvaluation", (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; +} + +message PromLabels{ + repeated Label labels = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/pkg/store/storepb/rules_custom.go b/pkg/store/storepb/rules_custom.go new file mode 100644 index 0000000000..cc16865f7a --- /dev/null +++ b/pkg/store/storepb/rules_custom.go @@ -0,0 +1,132 @@ +// Copyright (c) The Thanos Authors. +// Licensed under the Apache License 2.0. + +package storepb + +import ( + "encoding/json" + "sort" + "strconv" + "strings" + + "github.com/pkg/errors" + "github.com/prometheus/prometheus/pkg/labels" +) + +const ( + RuleRecordingType = "recording" + RuleAlertingType = "alerting" +) + +func (x *PartialResponseStrategy) UnmarshalJSON(entry []byte) error { + fieldStr, err := strconv.Unquote(string(entry)) + if err != nil { + return errors.Wrapf(err, "partialResponseStrategy: unquote %v", string(entry)) + } + + if len(fieldStr) == 0 { + // Default. + *x = PartialResponseStrategy_WARN + return nil + } + + strategy, ok := PartialResponseStrategy_value[strings.ToUpper(fieldStr)] + if !ok { + return errors.Errorf("unknown partialResponseStrategy: %v", string(entry)) + } + *x = PartialResponseStrategy(strategy) + return nil +} + +func (x *PartialResponseStrategy) MarshalJSON() ([]byte, error) { + return []byte(strconv.Quote(x.String())), nil +} + +func (m *Rule) UnmarshalJSON(entry []byte) error { + decider := struct { + Type string `json:"type"` + }{} + if err := json.Unmarshal(entry, &decider); err != nil { + return errors.Wrapf(err, "rule: type field unmarshal: %v", string(entry)) + } + + switch strings.ToLower(decider.Type) { + case "recording": + r := &RecordingRule{} + if err := json.Unmarshal(entry, r); err != nil { + return errors.Wrapf(err, "rule: recording rule unmarshal: %v", string(entry)) + } + + m.Result = &Rule_Recording{Recording: r} + case "alerting": + r := &Alert{} + if err := json.Unmarshal(entry, r); err != nil { + return errors.Wrapf(err, "rule: alerting rule unmarshal: %v", string(entry)) + } + + m.Result = &Rule_Alert{Alert: r} + case "": + return errors.Errorf("rule: no type field provided: %v", string(entry)) + default: + return errors.Errorf("rule: unknown type field provided %s; %v", decider.Type, string(entry)) + } + return nil +} + +func (m *Rule) MarshalJSON() ([]byte, error) { + if r := m.GetRecording(); r != nil { + return json.Marshal(struct { + *RecordingRule + Type string `json:"type"` + }{ + RecordingRule: r, + Type: RuleRecordingType, + }) + } + a := m.GetAlert() + return json.Marshal(struct { + *Alert + Type string `json:"type"` + }{ + Alert: a, + Type: RuleAlertingType, + }) +} + +func (x *AlertState) UnmarshalJSON(entry []byte) error { + fieldStr, err := strconv.Unquote(string(entry)) + if err != nil { + return errors.Wrapf(err, "alertState: unquote %v", string(entry)) + } + + if len(fieldStr) == 0 { + return errors.New("empty alertState") + } + + state, ok := AlertState_value[strings.ToUpper(fieldStr)] + if !ok { + return errors.Errorf("unknown alertState: %v", string(entry)) + } + *x = AlertState(state) + return nil +} + +func (x *AlertState) MarshalJSON() ([]byte, error) { + return []byte(strconv.Quote(x.String())), nil +} + +func (m *PromLabels) UnmarshalJSON(entry []byte) error { + lbls := labels.Labels{} + if err := lbls.UnmarshalJSON(entry); err != nil { + return errors.Wrapf(err, "labels: labels field unmarshal: %v", string(entry)) + } + m.Labels = PromLabelsToLabels(lbls) + sort.Slice(m.Labels, func(i, j int) bool { + return m.Labels[i].Name < m.Labels[j].Name + }) + return nil +} + +func (m *PromLabels) MarshalJSON() ([]byte, error) { + return LabelsToPromLabels(m.Labels).MarshalJSON() +} diff --git a/pkg/store/storepb/rules_custom_test.go b/pkg/store/storepb/rules_custom_test.go new file mode 100644 index 0000000000..8fc6f9bddf --- /dev/null +++ b/pkg/store/storepb/rules_custom_test.go @@ -0,0 +1,427 @@ +// Copyright (c) The Thanos Authors. +// Licensed under the Apache License 2.0. + +package storepb + +import ( + "encoding/json" + "testing" + "time" + + "github.com/pkg/errors" + "github.com/prometheus/prometheus/pkg/labels" + "github.com/prometheus/prometheus/rules" + "github.com/thanos-io/thanos/pkg/testutil" +) + +type prometheusAlert struct { + Labels labels.Labels `json:"labels"` + Annotations labels.Labels `json:"annotations"` + State string `json:"state"` + ActiveAt *time.Time `json:"activeAt,omitempty"` + Value string `json:"value"` + + PartialResponseStrategy string `json:"partialResponseStrategy"` +} + +// Same as https://github.com/prometheus/prometheus/blob/c530b4b456cc5f9ec249f771dff187eb7715dc9b/web/api/v1/api.go#L955 +// but with Partial Response. +type prometheusRuleGroup struct { + Name string `json:"name"` + File string `json:"file"` + Rules []prometheusRule `json:"rules"` + Interval float64 `json:"interval"` + EvaluationTime float64 `json:"evaluationTime"` + LastEvaluation time.Time `json:"lastEvaluation"` + + DeprecatedPartialResponseStrategy string `json:"partial_response_strategy"` + PartialResponseStrategy string `json:"partialResponseStrategy"` +} + +type prometheusRuleDiscovery struct { + RuleGroups []*prometheusRuleGroup `json:"groups"` +} + +type prometheusRule interface{} + +type prometheusAlertingRule struct { + // State can be "pending", "firing", "inactive". + State string `json:"state"` + Name string `json:"name"` + Query string `json:"query"` + Duration float64 `json:"duration"` + Labels labels.Labels `json:"labels"` + Annotations labels.Labels `json:"annotations"` + Alerts []*prometheusAlert `json:"alerts"` + Health rules.RuleHealth `json:"health"` + LastError string `json:"lastError,omitempty"` + EvaluationTime float64 `json:"evaluationTime"` + LastEvaluation time.Time `json:"lastEvaluation"` + // Type of an prometheusAlertingRule is always "alerting". + Type string `json:"type"` +} + +type prometheusRecordingRule struct { + Name string `json:"name"` + Query string `json:"query"` + Labels labels.Labels `json:"labels,omitempty"` + Health rules.RuleHealth `json:"health"` + LastError string `json:"lastError,omitempty"` + EvaluationTime float64 `json:"evaluationTime"` + LastEvaluation time.Time `json:"lastEvaluation"` + // Type of a prometheusRecordingRule is always "recording". + Type string `json:"type"` +} + +func TestJSONUnmarshalMarshal(t *testing.T) { + now := time.Now() + twoHoursAgo := now.Add(2 * time.Hour) + + for _, tcase := range []struct { + name string + input *prometheusRuleDiscovery + + expectedProto *RuleGroups + expectedErr error + expectedJSONOutput string // If empty, expected same one as marshaled input. + }{ + { + name: "Empty JSON", + input: &prometheusRuleDiscovery{}, + expectedProto: &RuleGroups{}, + }, + { + name: "one empty group", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + { + Name: "group1", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + DeprecatedPartialResponseStrategy: "WARN", + PartialResponseStrategy: "ABORT", + }, + }, + }, + expectedProto: &RuleGroups{ + Groups: []*RuleGroup{ + { + Name: "group1", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationDurationSeconds: 2.1, + DeprecatedPartialResponseStrategy: PartialResponseStrategy_WARN, + PartialResponseStrategy: PartialResponseStrategy_ABORT, + }, + }, + }, + }, + { + name: "one group with one empty group", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + {}, + }, + }, + expectedProto: &RuleGroups{ + Groups: []*RuleGroup{ + { + DeprecatedPartialResponseStrategy: PartialResponseStrategy_WARN, + PartialResponseStrategy: PartialResponseStrategy_WARN, + }, + }, + }, + // Different than input due to default enum fields. + expectedJSONOutput: `{"groups":[{"name":"","file":"","rules":null,"interval":0,"evaluationTime":0,"lastEvaluation":"0001-01-01T00:00:00Z","partial_response_strategy":"WARN","partialResponseStrategy":"WARN"}]}`, + }, + { + name: "one valid group, with 1 with no rule type", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + { + Name: "group1", + Rules: []prometheusRule{ + prometheusRecordingRule{ + Name: "recording1", + }, + }, + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + DeprecatedPartialResponseStrategy: "WARN", + PartialResponseStrategy: "ABORT", + }, + }, + }, + expectedErr: errors.New("rule: no type field provided: {\"name\":\"recording1\",\"query\":\"\",\"health\":\"\",\"evaluationTime\":0,\"lastEvaluation\":\"0001-01-01T00:00:00Z\",\"type\":\"\"}"), + }, + { + name: "one valid group, with 1 rule with invalid rule type", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + { + Name: "group1", + Rules: []prometheusRule{ + prometheusRecordingRule{ + Name: "recording1", + Type: "wrong", + }, + }, + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + DeprecatedPartialResponseStrategy: "WARN", + PartialResponseStrategy: "ABORT", + }, + }, + }, + expectedErr: errors.New("rule: unknown type field provided wrong; {\"name\":\"recording1\",\"query\":\"\",\"health\":\"\",\"evaluationTime\":0,\"lastEvaluation\":\"0001-01-01T00:00:00Z\",\"type\":\"wrong\"}"), + }, + { + name: "one valid group, with 1 rule with invalid alert state", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + { + Name: "group1", + Rules: []prometheusRule{ + prometheusAlertingRule{ + Name: "alert1", + Type: RuleAlertingType, + State: "sdfsdf", + }, + }, + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + DeprecatedPartialResponseStrategy: "WARN", + PartialResponseStrategy: "ABORT", + }, + }, + }, + expectedErr: errors.New("rule: alerting rule unmarshal: {\"state\":\"sdfsdf\",\"name\":\"alert1\",\"query\":\"\",\"duration\":0,\"labels\":{},\"annotations\":{},\"alerts\":null,\"health\":\"\",\"evaluationTime\":0,\"lastEvaluation\":\"0001-01-01T00:00:00Z\",\"type\":\"alerting\"}: unknown alertState: \"sdfsdf\""), + }, + { + name: "one group with WRONG partial response fields", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + { + Name: "group1", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + PartialResponseStrategy: "asdfsdfsdfsd", + }, + }, + }, + expectedErr: errors.New("unknown partialResponseStrategy: \"asdfsdfsdfsd\""), + }, + { + name: "one valid group, with 1 rule and alert each and second empty group.", + input: &prometheusRuleDiscovery{ + RuleGroups: []*prometheusRuleGroup{ + { + Name: "group1", + Rules: []prometheusRule{ + prometheusRecordingRule{ + Type: RuleRecordingType, + Query: "up", + Name: "recording1", + Labels: labels.Labels{ + {Name: "a", Value: "b"}, + {Name: "c", Value: "d"}, + {Name: "a", Value: "b"}, // Kind of invalid, but random one will be chosen. + }, + LastError: "2", + Health: "health", + LastEvaluation: now.Add(-2 * time.Minute), + EvaluationTime: 2.6, + }, + prometheusAlertingRule{ + Type: RuleAlertingType, + Name: "alert1", + Query: "up == 0", + Labels: labels.Labels{ + {Name: "a2", Value: "b2"}, + {Name: "c2", Value: "d2"}, + }, + Annotations: labels.Labels{ + {Name: "ann1", Value: "ann44"}, + {Name: "ann2", Value: "ann33"}, + }, + Health: "health2", + Alerts: []*prometheusAlert{ + { + Labels: labels.Labels{ + {Name: "instance1", Value: "1"}, + }, + Annotations: labels.Labels{ + {Name: "annotation1", Value: "2"}, + }, + State: "INACTIVE", + ActiveAt: nil, + Value: "1", + PartialResponseStrategy: "WARN", + }, + { + Labels: nil, + Annotations: nil, + State: "FIRING", + ActiveAt: &twoHoursAgo, + Value: "2143", + PartialResponseStrategy: "ABORT", + }, + }, + LastError: "1", + Duration: 60, + State: "PENDING", + LastEvaluation: now.Add(-1 * time.Minute), + EvaluationTime: 1.1, + }, + }, + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + DeprecatedPartialResponseStrategy: "WARN", + PartialResponseStrategy: "ABORT", + }, + { + Name: "group2", + File: "file2.yml", + Interval: 242342442, + LastEvaluation: now.Add(40 * time.Hour), + EvaluationTime: 21244.1, + DeprecatedPartialResponseStrategy: "ABORT", + PartialResponseStrategy: "ABORT", + }, + }, + }, + expectedProto: &RuleGroups{ + Groups: []*RuleGroup{ + { + Name: "group1", + Rules: []*Rule{ + { + Result: &Rule_Recording{ + Recording: &RecordingRule{ + Query: "up", + Name: "recording1", + Labels: &PromLabels{ + Labels: []Label{ + {Name: "a", Value: "b"}, + {Name: "c", Value: "d"}, + }, + }, + LastError: "2", + Health: "health", + LastEvaluation: now.Add(-2 * time.Minute), + EvaluationDurationSeconds: 2.6, + }, + }, + }, + { + Result: &Rule_Alert{ + Alert: &Alert{ + Name: "alert1", + Query: "up == 0", + Labels: &PromLabels{ + Labels: []Label{ + {Name: "a2", Value: "b2"}, + {Name: "c2", Value: "d2"}, + }, + }, + Annotations: &PromLabels{ + Labels: []Label{ + {Name: "ann1", Value: "ann44"}, + {Name: "ann2", Value: "ann33"}, + }, + }, + Alerts: []*AlertInstance{ + { + Labels: &PromLabels{ + Labels: []Label{ + {Name: "instance1", Value: "1"}, + }, + }, + Annotations: &PromLabels{ + Labels: []Label{ + {Name: "annotation1", Value: "2"}, + }, + }, + State: AlertState_INACTIVE, + ActiveAt: nil, + Value: "1", + PartialResponseStrategy: PartialResponseStrategy_WARN, + }, + { + Labels: &PromLabels{}, + Annotations: &PromLabels{}, + State: AlertState_FIRING, + ActiveAt: &twoHoursAgo, + Value: "2143", + PartialResponseStrategy: PartialResponseStrategy_ABORT, + }, + }, + DurationSeconds: 60, + State: AlertState_PENDING, + LastError: "1", + Health: "health2", + LastEvaluation: now.Add(-1 * time.Minute), + EvaluationDurationSeconds: 1.1, + }, + }, + }, + }, + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationDurationSeconds: 2.1, + DeprecatedPartialResponseStrategy: PartialResponseStrategy_WARN, + PartialResponseStrategy: PartialResponseStrategy_ABORT, + }, + { + Name: "group2", + File: "file2.yml", + Interval: 242342442, + LastEvaluation: now.Add(40 * time.Hour), + EvaluationDurationSeconds: 21244.1, + DeprecatedPartialResponseStrategy: PartialResponseStrategy_ABORT, + PartialResponseStrategy: PartialResponseStrategy_ABORT, + }, + }, + }, + }, + } { + if ok := t.Run(tcase.name, func(t *testing.T) { + jsonInput, err := json.Marshal(tcase.input) + testutil.Ok(t, err) + + proto := &RuleGroups{} + err = json.Unmarshal(jsonInput, proto) + if tcase.expectedErr != nil { + testutil.NotOk(t, err) + testutil.Equals(t, tcase.expectedErr.Error(), err.Error()) + return + } + testutil.Ok(t, err) + testutil.Equals(t, tcase.expectedProto.String(), proto.String()) + + jsonProto, err := json.Marshal(proto) + testutil.Ok(t, err) + if tcase.expectedJSONOutput != "" { + testutil.Equals(t, tcase.expectedJSONOutput, string(jsonProto)) + return + } + testutil.Equals(t, jsonInput, jsonProto) + }); !ok { + return + } + } +} diff --git a/pkg/store/storepb/types.pb.go b/pkg/store/storepb/types.pb.go index 89e3787d24..37e9fa812d 100644 --- a/pkg/store/storepb/types.pb.go +++ b/pkg/store/storepb/types.pb.go @@ -24,6 +24,40 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +/// PartialResponseStrategy controls partial response handling. +type PartialResponseStrategy int32 + +const ( + /// WARN strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying + /// storeAPI is temporarily not available) as warning which will not fail the whole query (still OK response). + /// Server should produce those as a warnings field in response. + PartialResponseStrategy_WARN PartialResponseStrategy = 0 + /// ABORT strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying + /// storeAPI is temporarily not available) as the gRPC error that aborts the query. + /// + /// This is especially useful for any rule/alert evaluations on top of StoreAPI which usually does not tolerate partial + /// errors. + PartialResponseStrategy_ABORT PartialResponseStrategy = 1 +) + +var PartialResponseStrategy_name = map[int32]string{ + 0: "WARN", + 1: "ABORT", +} + +var PartialResponseStrategy_value = map[string]int32{ + "WARN": 0, + "ABORT": 1, +} + +func (x PartialResponseStrategy) String() string { + return proto.EnumName(PartialResponseStrategy_name, int32(x)) +} + +func (PartialResponseStrategy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_d938547f84707355, []int{0} +} + type Chunk_Encoding int32 const ( @@ -276,6 +310,7 @@ func (m *LabelMatcher) XXX_DiscardUnknown() { var xxx_messageInfo_LabelMatcher proto.InternalMessageInfo func init() { + proto.RegisterEnum("thanos.PartialResponseStrategy", PartialResponseStrategy_name, PartialResponseStrategy_value) proto.RegisterEnum("thanos.Chunk_Encoding", Chunk_Encoding_name, Chunk_Encoding_value) proto.RegisterEnum("thanos.LabelMatcher_Type", LabelMatcher_Type_name, LabelMatcher_Type_value) proto.RegisterType((*Label)(nil), "thanos.Label") @@ -288,35 +323,38 @@ func init() { func init() { proto.RegisterFile("types.proto", fileDescriptor_d938547f84707355) } var fileDescriptor_d938547f84707355 = []byte{ - // 445 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xbd, 0xfe, 0x4c, 0xa7, 0x05, 0x99, 0xa5, 0x42, 0x5b, 0x0e, 0x6e, 0x64, 0x84, 0x88, - 0x40, 0xb8, 0xa2, 0x3c, 0x01, 0x45, 0xbe, 0xf1, 0xa1, 0x2e, 0x3d, 0x20, 0x84, 0x84, 0x36, 0xe9, - 0xe2, 0x58, 0xc4, 0xeb, 0xc8, 0x5e, 0x43, 0xfa, 0x16, 0x20, 0x5e, 0x2a, 0xc7, 0x1e, 0x39, 0x21, - 0x48, 0x5e, 0x04, 0xed, 0xd8, 0xa6, 0xad, 0xe4, 0xdb, 0xec, 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0x61, 0x46, 0x03, 0x25, 0xfd, 0x02, 0x00, 0x00, + // 485 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x93, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xc7, 0xfd, 0x3f, 0xc9, 0xb4, 0xbf, 0x9f, 0xcc, 0x52, 0xc1, 0x96, 0x83, 0x1b, 0x19, 0x21, + 0xa2, 0x22, 0x5c, 0x51, 0x9e, 0x20, 0x41, 0xb9, 0x41, 0x4b, 0xb7, 0x91, 0x40, 0x08, 0x09, 0x6d, + 0xd2, 0xc5, 0xb1, 0x88, 0xd7, 0x91, 0x77, 0x03, 0xc9, 0x5b, 0x80, 0x78, 0xa9, 0x1c, 0x7b, 0xe4, + 0x84, 0x20, 0x79, 0x11, 0xb4, 0xe3, 0x18, 0x5a, 0xc9, 0xb7, 0xf1, 0x7c, 0x3f, 0x33, 0xdf, 0xd1, + 0xce, 0x18, 0xf6, 0xf4, 0x6a, 0x2e, 0x54, 0x32, 0x2f, 0x0b, 0x5d, 0x90, 0x40, 0x4f, 0xb9, 0x2c, + 0xd4, 0x83, 0x83, 0xb4, 0x48, 0x0b, 0x4c, 0x9d, 0x98, 0xa8, 0x52, 0xe3, 0x67, 0xe0, 0xbf, 0xe4, + 0x63, 0x31, 0x23, 0x04, 0x3c, 0xc9, 0x73, 0x41, 0xed, 0xae, 0xdd, 0xeb, 0x30, 0x8c, 0xc9, 0x01, + 0xf8, 0x9f, 0xf9, 0x6c, 0x21, 0xa8, 0x83, 0xc9, 0xea, 0x23, 0x7e, 0x0f, 0xfe, 0x8b, 0xe9, 0x42, + 0x7e, 0x22, 0xc7, 0xe0, 0x19, 0x23, 0x2c, 0xf9, 0xff, 0xf4, 0x5e, 0x52, 0x19, 0x25, 0x28, 0x26, + 0x43, 0x39, 0x29, 0xae, 0x32, 0x99, 0x32, 0x64, 0x4c, 0xfb, 0x2b, 0xae, 0x39, 0x76, 0xda, 0x67, + 0x18, 0xc7, 0x77, 0xa1, 0x5d, 0x53, 0xa4, 0x05, 0xee, 0xdb, 0x73, 0x16, 0x5a, 0xf1, 0x47, 0x08, + 0x2e, 0x45, 0x99, 0x09, 0x45, 0x9e, 0x40, 0x30, 0x33, 0xa3, 0x29, 0x6a, 0x77, 0xdd, 0xde, 0xde, + 0xe9, 0x7f, 0xb5, 0x01, 0x0e, 0x3c, 0xf0, 0xd6, 0x3f, 0x8f, 0x2c, 0xb6, 0x43, 0xc8, 0x09, 0x04, + 0x13, 0xe3, 0xab, 0xa8, 0x83, 0xf0, 0x9d, 0x1a, 0xee, 0xa7, 0x69, 0x89, 0x13, 0xd5, 0x05, 0x15, + 0x16, 0x7f, 0x77, 0xa0, 0xf3, 0x57, 0x23, 0x87, 0xd0, 0xce, 0x33, 0xf9, 0x41, 0x67, 0xbb, 0x17, + 0x70, 0x59, 0x2b, 0xcf, 0xe4, 0x28, 0xcb, 0x05, 0x4a, 0x7c, 0x59, 0x49, 0xce, 0x4e, 0xe2, 0x4b, + 0x94, 0x8e, 0xc0, 0x2d, 0xf9, 0x17, 0xea, 0x76, 0xed, 0x9b, 0xe3, 0x61, 0x47, 0x66, 0x14, 0xf2, + 0x10, 0xfc, 0x49, 0xb1, 0x90, 0x9a, 0x7a, 0x4d, 0x48, 0xa5, 0x99, 0x2e, 0x6a, 0x91, 0x53, 0xbf, + 0xb1, 0x8b, 0x5a, 0xe4, 0x06, 0xc8, 0x33, 0x49, 0x83, 0x46, 0x20, 0xcf, 0x24, 0x02, 0x7c, 0x49, + 0x5b, 0xcd, 0x00, 0x5f, 0x92, 0xc7, 0xd0, 0x42, 0x2f, 0x51, 0xd2, 0x76, 0x13, 0x54, 0xab, 0xf1, + 0x37, 0x1b, 0xf6, 0xf1, 0x79, 0x5f, 0x71, 0x3d, 0x99, 0x8a, 0x92, 0x3c, 0xbd, 0xb5, 0xe3, 0xc3, + 0x5b, 0x2b, 0xd8, 0x31, 0xc9, 0x68, 0x35, 0x17, 0xff, 0xd6, 0x8c, 0x57, 0xe4, 0x34, 0x5d, 0x91, + 0x7b, 0xf3, 0x8a, 0x7a, 0xe0, 0x99, 0x3a, 0x12, 0x80, 0x33, 0xbc, 0x08, 0x2d, 0x73, 0x00, 0x67, + 0xc3, 0x8b, 0xd0, 0x36, 0x09, 0x36, 0x0c, 0x1d, 0x4c, 0xb0, 0x61, 0xe8, 0x1e, 0x27, 0x70, 0xff, + 0x35, 0x2f, 0x75, 0xc6, 0x67, 0x4c, 0xa8, 0x79, 0x21, 0x95, 0xb8, 0xd4, 0x25, 0xd7, 0x22, 0x5d, + 0x91, 0x36, 0x78, 0x6f, 0xfa, 0xec, 0x2c, 0xb4, 0x48, 0x07, 0xfc, 0xfe, 0xe0, 0x9c, 0x8d, 0x42, + 0x7b, 0xf0, 0x68, 0xfd, 0x3b, 0xb2, 0xd6, 0x9b, 0xc8, 0xbe, 0xde, 0x44, 0xf6, 0xaf, 0x4d, 0x64, + 0x7f, 0xdd, 0x46, 0xd6, 0xf5, 0x36, 0xb2, 0x7e, 0x6c, 0x23, 0xeb, 0x5d, 0x4b, 0xe9, 0xa2, 0x14, + 0xf3, 0xf1, 0x38, 0xc0, 0x1f, 0xe0, 0xf9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0xf7, 0xda, + 0x10, 0x2d, 0x03, 0x00, 0x00, } func (m *Label) Marshal() (dAtA []byte, err error) { diff --git a/pkg/store/storepb/types.proto b/pkg/store/storepb/types.proto index 635aa50469..4cd993f863 100644 --- a/pkg/store/storepb/types.proto +++ b/pkg/store/storepb/types.proto @@ -61,3 +61,17 @@ message LabelMatcher { string name = 2; string value = 3; } + +/// PartialResponseStrategy controls partial response handling. +enum PartialResponseStrategy { + /// WARN strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying + /// storeAPI is temporarily not available) as warning which will not fail the whole query (still OK response). + /// Server should produce those as a warnings field in response. + WARN = 0; + /// ABORT strategy tells server to treat any error that will related to single StoreAPI (e.g missing chunk series because of underlying + /// storeAPI is temporarily not available) as the gRPC error that aborts the query. + /// + /// This is especially useful for any rule/alert evaluations on top of StoreAPI which usually does not tolerate partial + /// errors. + ABORT = 1; +} \ No newline at end of file diff --git a/scripts/genproto.sh b/scripts/genproto.sh index 2df48ba70f..1311ee8d76 100755 --- a/scripts/genproto.sh +++ b/scripts/genproto.sh @@ -29,13 +29,14 @@ DIRS="pkg/store/storepb" echo "generating code" for dir in ${DIRS}; do pushd ${dir} - ${PROTOC_BIN} --gogofast_out=plugins=grpc:. -I=. \ + ${PROTOC_BIN} --gogofast_out=plugins=grpc:. \ + -I=. \ -I="${GOGOPROTO_PATH}" \ -I="../../../vendor" \ *.proto sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go - sed -i.bak -E 's/import _ \"google\/protobuf\"//g' *.pb.go + sed -i.bak -E 's/_ \"google\/protobuf\"//g' *.pb.go rm -f *.bak ${GOIMPORTS_BIN} -w *.pb.go popd