diff --git a/CHANGELOG.md b/CHANGELOG.md index caa81a2694..3846ab4981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ We use *breaking* word for marking changes that are not backward compatible (rel ## Unreleased +:warning: **WARNING** :warning: Thanos Rule's `/api/v1/rules` endpoint no longer returns the old, deprecated `partial_response_strategy`. The old, deprecated value has been fixed to `WARN` for quite some time. _Please_ use `partialResponseStrategy`. + ### Fixed - [#2937](https://github.com/thanos-io/thanos/pull/2937) Receive: Fixing auto-configuration of --receive.local-endpoint @@ -23,6 +25,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel - [#2936](https://github.com/thanos-io/thanos/pull/2936) Compact: Fix ReplicaLabelRemover panic when replicaLabels are not specified. - [#2956](https://github.com/thanos-io/thanos/pull/2956) Store: Fix fetching of chunks bigger than 16000 bytes. - [#2970](https://github.com/thanos-io/thanos/pull/2970) Store: Upgrade minio-go/v7 to fix slowness when running on EKS. +- [#2957](https://github.com/thanos-io/thanos/pull/2957) Rule: now sets all of the relevant fields properly; avoids a panic when `/api/v1/rules` is called and the time zone is _not_ UTC; `rules` field is an empty array now if no rules have been defined in a rule group. - [#2976](https://github.com/thanos-io/thanos/pull/2976) Query: Better rounding for incoming query timestamps. ### Added diff --git a/pkg/api/query/v1_test.go b/pkg/api/query/v1_test.go index 54ccdffe41..91c222a3d8 100644 --- a/pkg/api/query/v1_test.go +++ b/pkg/api/query/v1_test.go @@ -1138,48 +1138,44 @@ func TestRulesHandler(t *testing.T) { g: map[rulespb.RulesRequest_Type][]*rulespb.RuleGroup{ rulespb.RulesRequest_ALL: { { - Name: "grp", - File: "/path/to/groupfile1", - Rules: all, - Interval: 1, - EvaluationDurationSeconds: 214, - LastEvaluation: time.Time{}.Add(10 * time.Minute), - DeprecatedPartialResponseStrategy: 0, - PartialResponseStrategy: storepb.PartialResponseStrategy_WARN, + Name: "grp", + File: "/path/to/groupfile1", + Rules: all, + Interval: 1, + EvaluationDurationSeconds: 214, + LastEvaluation: time.Time{}.Add(10 * time.Minute), + PartialResponseStrategy: storepb.PartialResponseStrategy_WARN, }, { - Name: "grp2", - File: "/path/to/groupfile2", - Rules: all[3:], - Interval: 10, - EvaluationDurationSeconds: 2142, - LastEvaluation: time.Time{}.Add(100 * time.Minute), - DeprecatedPartialResponseStrategy: 0, - PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "grp2", + File: "/path/to/groupfile2", + Rules: all[3:], + Interval: 10, + EvaluationDurationSeconds: 2142, + LastEvaluation: time.Time{}.Add(100 * time.Minute), + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, }, rulespb.RulesRequest_RECORD: { { - Name: "grp", - File: "/path/to/groupfile1", - Rules: all[:2], - Interval: 1, - EvaluationDurationSeconds: 214, - LastEvaluation: time.Time{}.Add(20 * time.Minute), - DeprecatedPartialResponseStrategy: 0, - PartialResponseStrategy: storepb.PartialResponseStrategy_WARN, + Name: "grp", + File: "/path/to/groupfile1", + Rules: all[:2], + Interval: 1, + EvaluationDurationSeconds: 214, + LastEvaluation: time.Time{}.Add(20 * time.Minute), + PartialResponseStrategy: storepb.PartialResponseStrategy_WARN, }, }, rulespb.RulesRequest_ALERT: { { - Name: "grp", - File: "/path/to/groupfile1", - Rules: all[2:], - Interval: 1, - EvaluationDurationSeconds: 214, - LastEvaluation: time.Time{}.Add(30 * time.Minute), - DeprecatedPartialResponseStrategy: 0, - PartialResponseStrategy: storepb.PartialResponseStrategy_WARN, + Name: "grp", + File: "/path/to/groupfile1", + Rules: all[2:], + Interval: 1, + EvaluationDurationSeconds: 214, + LastEvaluation: time.Time{}.Add(30 * time.Minute), + PartialResponseStrategy: storepb.PartialResponseStrategy_WARN, }, }, }, @@ -1262,24 +1258,22 @@ func TestRulesHandler(t *testing.T) { response: &testpromcompatibility.RuleDiscovery{ RuleGroups: []*testpromcompatibility.RuleGroup{ { - Name: "grp", - File: "/path/to/groupfile1", - Rules: expectedAll, - Interval: 1, - EvaluationTime: 214, - LastEvaluation: time.Time{}.Add(10 * time.Minute), - PartialResponseStrategy: "WARN", - DeprecatedPartialResponseStrategy: "WARN", + Name: "grp", + File: "/path/to/groupfile1", + Rules: expectedAll, + Interval: 1, + EvaluationTime: 214, + LastEvaluation: time.Time{}.Add(10 * time.Minute), + PartialResponseStrategy: "WARN", }, { - Name: "grp2", - File: "/path/to/groupfile2", - Rules: expectedAll[3:], - Interval: 10, - EvaluationTime: 2142, - LastEvaluation: time.Time{}.Add(100 * time.Minute), - PartialResponseStrategy: "ABORT", - DeprecatedPartialResponseStrategy: "WARN", + Name: "grp2", + File: "/path/to/groupfile2", + Rules: expectedAll[3:], + Interval: 10, + EvaluationTime: 2142, + LastEvaluation: time.Time{}.Add(100 * time.Minute), + PartialResponseStrategy: "ABORT", }, }, }, @@ -1289,14 +1283,13 @@ func TestRulesHandler(t *testing.T) { response: &testpromcompatibility.RuleDiscovery{ RuleGroups: []*testpromcompatibility.RuleGroup{ { - Name: "grp", - File: "/path/to/groupfile1", - Rules: expectedAll[:2], - Interval: 1, - EvaluationTime: 214, - LastEvaluation: time.Time{}.Add(20 * time.Minute), - PartialResponseStrategy: "WARN", - DeprecatedPartialResponseStrategy: "WARN", + Name: "grp", + File: "/path/to/groupfile1", + Rules: expectedAll[:2], + Interval: 1, + EvaluationTime: 214, + LastEvaluation: time.Time{}.Add(20 * time.Minute), + PartialResponseStrategy: "WARN", }, }, }, @@ -1306,14 +1299,13 @@ func TestRulesHandler(t *testing.T) { response: &testpromcompatibility.RuleDiscovery{ RuleGroups: []*testpromcompatibility.RuleGroup{ { - Name: "grp", - File: "/path/to/groupfile1", - Rules: expectedAll[2:], - Interval: 1, - EvaluationTime: 214, - LastEvaluation: time.Time{}.Add(30 * time.Minute), - PartialResponseStrategy: "WARN", - DeprecatedPartialResponseStrategy: "WARN", + Name: "grp", + File: "/path/to/groupfile1", + Rules: expectedAll[2:], + Interval: 1, + EvaluationTime: 214, + LastEvaluation: time.Time{}.Add(30 * time.Minute), + PartialResponseStrategy: "WARN", }, }, }, diff --git a/pkg/rules/manager.go b/pkg/rules/manager.go index b6c1f420a5..35b554402d 100644 --- a/pkg/rules/manager.go +++ b/pkg/rules/manager.go @@ -44,6 +44,9 @@ func (g Group) toProto() *rulespb.RuleGroup { File: g.OriginalFile, Interval: g.Interval().Seconds(), PartialResponseStrategy: g.PartialResponseStrategy, + // https://github.com/gogo/protobuf/issues/519 + LastEvaluation: g.GetEvaluationTimestamp().UTC(), + EvaluationDurationSeconds: g.GetEvaluationDuration().Seconds(), } for _, r := range g.Rules() { @@ -66,7 +69,8 @@ func (g Group) toProto() *rulespb.RuleGroup { Health: string(rule.Health()), LastError: lastError, EvaluationDurationSeconds: rule.GetEvaluationDuration().Seconds(), - LastEvaluation: rule.GetEvaluationTimestamp(), + // https://github.com/gogo/protobuf/issues/519 + LastEvaluation: rule.GetEvaluationTimestamp().UTC(), }}}) case *rules.RecordingRule: ret.Rules = append(ret.Rules, &rulespb.Rule{ @@ -77,7 +81,8 @@ func (g Group) toProto() *rulespb.RuleGroup { Health: string(rule.Health()), LastError: lastError, EvaluationDurationSeconds: rule.GetEvaluationDuration().Seconds(), - LastEvaluation: rule.GetEvaluationTimestamp(), + // https://github.com/gogo/protobuf/issues/519 + LastEvaluation: rule.GetEvaluationTimestamp().UTC(), }}}) default: // We cannot do much, let's panic, API will recover. diff --git a/pkg/rules/rules_test.go b/pkg/rules/rules_test.go index 1e28c058ce..2d7b1c9c76 100644 --- a/pkg/rules/rules_test.go +++ b/pkg/rules/rules_test.go @@ -28,25 +28,25 @@ func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServ expected := []*rulespb.RuleGroup{ { - Name: "thanos-bucket-replicate.rules", - File: filepath.Join(dir, "alerts.yaml"), - Rules: []*rulespb.Rule{someAlert, someAlert, someAlert}, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "thanos-bucket-replicate.rules", + File: filepath.Join(dir, "alerts.yaml"), + Rules: []*rulespb.Rule{someAlert, someAlert, someAlert}, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { - Name: "thanos-compact.rules", - File: filepath.Join(dir, "alerts.yaml"), - Rules: []*rulespb.Rule{someAlert, someAlert, someAlert, someAlert, someAlert}, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "thanos-compact.rules", + File: filepath.Join(dir, "alerts.yaml"), + Rules: []*rulespb.Rule{someAlert, someAlert, someAlert, someAlert, someAlert}, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { - Name: "thanos-component-absent.rules", - File: filepath.Join(dir, "alerts.yaml"), - Rules: []*rulespb.Rule{someAlert, someAlert, someAlert, someAlert, someAlert, someAlert}, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "thanos-component-absent.rules", + File: filepath.Join(dir, "alerts.yaml"), + Rules: []*rulespb.Rule{someAlert, someAlert, someAlert, someAlert, someAlert, someAlert}, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { Name: "thanos-query.rules", @@ -55,8 +55,8 @@ func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServ someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someRecording, someRecording, someRecording, someRecording, someRecording, }, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { Name: "thanos-receive.rules", @@ -65,22 +65,22 @@ func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServ someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someRecording, someRecording, someRecording, someRecording, someRecording, someRecording, someRecording, }, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { - Name: "thanos-rule.rules", - File: filepath.Join(dir, "alerts.yaml"), - Rules: []*rulespb.Rule{someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert}, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "thanos-rule.rules", + File: filepath.Join(dir, "alerts.yaml"), + Rules: []*rulespb.Rule{someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert, someAlert}, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { - Name: "thanos-sidecar.rules", - File: filepath.Join(dir, "alerts.yaml"), - Rules: []*rulespb.Rule{someAlert, someAlert}, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "thanos-sidecar.rules", + File: filepath.Join(dir, "alerts.yaml"), + Rules: []*rulespb.Rule{someAlert, someAlert}, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { Name: "thanos-store.rules", @@ -89,8 +89,8 @@ func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServ someAlert, someAlert, someAlert, someAlert, someRecording, someRecording, someRecording, someRecording, }, - Interval: 60, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Interval: 60, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, } diff --git a/pkg/rules/rulespb/custom.go b/pkg/rules/rulespb/custom.go index 2d49ae72ce..3d25c96ef0 100644 --- a/pkg/rules/rulespb/custom.go +++ b/pkg/rules/rulespb/custom.go @@ -241,6 +241,15 @@ func (m *Rule) MarshalJSON() ([]byte, error) { }) } +func (r *RuleGroup) MarshalJSON() ([]byte, error) { + if r.Rules == nil { + // Ensure that empty slices are marshaled as '[]' and not 'null'. + r.Rules = make([]*Rule, 0) + } + type plain RuleGroup + return json.Marshal((*plain)(r)) +} + func (x *AlertState) UnmarshalJSON(entry []byte) error { fieldStr, err := strconv.Unquote(string(entry)) if err != nil { diff --git a/pkg/rules/rulespb/custom_test.go b/pkg/rules/rulespb/custom_test.go index 89c5e9babc..ca298f14d7 100644 --- a/pkg/rules/rulespb/custom_test.go +++ b/pkg/rules/rulespb/custom_test.go @@ -39,26 +39,25 @@ func TestJSONUnmarshalMarshal(t *testing.T) { input: &testpromcompatibility.RuleDiscovery{ RuleGroups: []*testpromcompatibility.RuleGroup{ { - Name: "group1", - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationTime: 2.1, - DeprecatedPartialResponseStrategy: "WARN", - PartialResponseStrategy: "ABORT", + Name: "group1", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + PartialResponseStrategy: "ABORT", }, }, }, expectedProto: &RuleGroups{ Groups: []*RuleGroup{ { - Name: "group1", - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationDurationSeconds: 2.1, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, - PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "group1", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationDurationSeconds: 2.1, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Rules: []*Rule{}, }, }, }, @@ -73,13 +72,12 @@ func TestJSONUnmarshalMarshal(t *testing.T) { expectedProto: &RuleGroups{ Groups: []*RuleGroup{ { - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, - PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, }, }, // 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":"ABORT","partialResponseStrategy":"ABORT"}]}`, + expectedJSONOutput: `{"groups":[{"name":"","file":"","rules":[],"interval":0,"evaluationTime":0,"lastEvaluation":"0001-01-01T00:00:00Z","partialResponseStrategy":"ABORT"}]}`, }, { name: "one valid group, with 1 with no rule type", @@ -92,12 +90,11 @@ func TestJSONUnmarshalMarshal(t *testing.T) { Name: "recording1", }, }, - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationTime: 2.1, - DeprecatedPartialResponseStrategy: "WARN", - PartialResponseStrategy: "ABORT", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + PartialResponseStrategy: "ABORT", }, }, }, @@ -115,12 +112,11 @@ func TestJSONUnmarshalMarshal(t *testing.T) { Type: "wrong", }, }, - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationTime: 2.1, - DeprecatedPartialResponseStrategy: "WARN", - PartialResponseStrategy: "ABORT", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + PartialResponseStrategy: "ABORT", }, }, }, @@ -139,12 +135,11 @@ func TestJSONUnmarshalMarshal(t *testing.T) { State: "sdfsdf", }, }, - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationTime: 2.1, - DeprecatedPartialResponseStrategy: "WARN", - PartialResponseStrategy: "ABORT", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + PartialResponseStrategy: "ABORT", }, }, }, @@ -192,11 +187,10 @@ func TestJSONUnmarshalMarshal(t *testing.T) { EvaluationTime: 1.1, }, }, - File: "file1.yml", - Interval: 2442, - EvaluationTime: 2.1, - DeprecatedPartialResponseStrategy: "WARN", - PartialResponseStrategy: "ABORT", + File: "file1.yml", + Interval: 2442, + EvaluationTime: 2.1, + PartialResponseStrategy: "ABORT", }, }, }, @@ -227,16 +221,15 @@ func TestJSONUnmarshalMarshal(t *testing.T) { EvaluationDurationSeconds: 1.1, }), }, - File: "file1.yml", - Interval: 2442, - EvaluationDurationSeconds: 2.1, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, - PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + File: "file1.yml", + Interval: 2442, + EvaluationDurationSeconds: 2.1, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, }, }, // Different than input due to the alerts slice being initialized to a zero-length slice instead of nil. - expectedJSONOutput: `{"groups":[{"name":"group1","file":"file1.yml","rules":[{"state":"pending","name":"alert1","query":"up == 0","duration":60,"labels":{"a2":"b2","c2":"d2"},"annotations":{"ann1":"ann44","ann2":"ann33"},"alerts":[],"health":"health2","lastError":"1","evaluationTime":1.1,"lastEvaluation":"0001-01-01T00:00:00Z","type":"alerting"}],"interval":2442,"evaluationTime":2.1,"lastEvaluation":"0001-01-01T00:00:00Z","partial_response_strategy":"WARN","partialResponseStrategy":"ABORT"}]}`, + expectedJSONOutput: `{"groups":[{"name":"group1","file":"file1.yml","rules":[{"state":"pending","name":"alert1","query":"up == 0","duration":60,"labels":{"a2":"b2","c2":"d2"},"annotations":{"ann1":"ann44","ann2":"ann33"},"alerts":[],"health":"health2","lastError":"1","evaluationTime":1.1,"lastEvaluation":"0001-01-01T00:00:00Z","type":"alerting"}],"interval":2442,"evaluationTime":2.1,"lastEvaluation":"0001-01-01T00:00:00Z","partialResponseStrategy":"ABORT"}]}`, }, { name: "one valid group, with 1 rule and alert each and second empty group.", @@ -301,21 +294,19 @@ func TestJSONUnmarshalMarshal(t *testing.T) { EvaluationTime: 1.1, }, }, - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationTime: 2.1, - DeprecatedPartialResponseStrategy: "WARN", - PartialResponseStrategy: "ABORT", + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationTime: 2.1, + PartialResponseStrategy: "ABORT", }, { - Name: "group2", - File: "file2.yml", - Interval: 242342442, - LastEvaluation: now.Add(40 * time.Hour), - EvaluationTime: 21244.1, - DeprecatedPartialResponseStrategy: "ABORT", - PartialResponseStrategy: "ABORT", + Name: "group2", + File: "file2.yml", + Interval: 242342442, + LastEvaluation: now.Add(40 * time.Hour), + EvaluationTime: 21244.1, + PartialResponseStrategy: "ABORT", }, }, }, @@ -385,21 +376,20 @@ func TestJSONUnmarshalMarshal(t *testing.T) { EvaluationDurationSeconds: 1.1, }), }, - File: "file1.yml", - Interval: 2442, - LastEvaluation: now, - EvaluationDurationSeconds: 2.1, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_WARN, - PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + File: "file1.yml", + Interval: 2442, + LastEvaluation: now, + EvaluationDurationSeconds: 2.1, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, }, { - Name: "group2", - File: "file2.yml", - Interval: 242342442, - LastEvaluation: now.Add(40 * time.Hour), - EvaluationDurationSeconds: 21244.1, - DeprecatedPartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, - PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Name: "group2", + File: "file2.yml", + Interval: 242342442, + LastEvaluation: now.Add(40 * time.Hour), + EvaluationDurationSeconds: 21244.1, + PartialResponseStrategy: storepb.PartialResponseStrategy_ABORT, + Rules: []*Rule{}, }, }, }, diff --git a/pkg/rules/rulespb/rpc.pb.go b/pkg/rules/rulespb/rpc.pb.go index 84ef29d301..2fda7b2fe8 100644 --- a/pkg/rules/rulespb/rpc.pb.go +++ b/pkg/rules/rulespb/rpc.pb.go @@ -279,8 +279,7 @@ type RuleGroup struct { 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 storepb.PartialResponseStrategy `protobuf:"varint,7,opt,name=DeprecatedPartialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partial_response_strategy"` - PartialResponseStrategy storepb.PartialResponseStrategy `protobuf:"varint,8,opt,name=PartialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partialResponseStrategy"` + PartialResponseStrategy storepb.PartialResponseStrategy `protobuf:"varint,8,opt,name=PartialResponseStrategy,proto3,enum=thanos.PartialResponseStrategy" json:"partialResponseStrategy"` } func (m *RuleGroup) Reset() { *m = RuleGroup{} } @@ -589,72 +588,70 @@ func init() { func init() { proto.RegisterFile("rules/rulespb/rpc.proto", fileDescriptor_91b1d28f30eb5efb) } var fileDescriptor_91b1d28f30eb5efb = []byte{ - // 1028 bytes of a gzipped FileDescriptorProto + // 998 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x26, 0x2d, 0x91, 0x12, 0xc7, 0x3f, 0x71, 0x37, 0x31, 0x4c, 0x2b, 0xad, 0xe8, 0x0a, 0x48, - 0xe1, 0xfe, 0x44, 0x2a, 0x6c, 0x24, 0x45, 0x7a, 0x29, 0x4c, 0x5b, 0x8d, 0x05, 0x18, 0x6e, 0xb0, - 0x16, 0x7a, 0x68, 0x0f, 0xea, 0x4a, 0xda, 0xc8, 0x02, 0x28, 0x92, 0xd9, 0x5d, 0xb9, 0xd0, 0x13, - 0xf4, 0xd2, 0x43, 0xee, 0x7d, 0x92, 0x5e, 0x7b, 0xf2, 0x31, 0xc7, 0x1e, 0x0a, 0xb6, 0xb5, 0x6f, - 0x7a, 0x8a, 0x82, 0xbb, 0xa4, 0x28, 0xbb, 0x52, 0xed, 0x20, 0xea, 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a, 0xe7, 0xa3, 0xec, + 0xd5, 0x90, 0x09, 0x49, 0x1e, 0x43, 0x3e, 0x0e, 0x6b, 0xeb, 0xdb, 0xfa, 0xce, 0xda, 0xee, 0x56, + 0x55, 0x65, 0xae, 0xce, 0x62, 0xaa, 0xad, 0x51, 0xc4, 0x28, 0xc2, 0xc8, 0x8f, 0xb0, 0x15, 0x79, + 0x5c, 0xf6, 0x3d, 0xbf, 0xcd, 0x99, 0x88, 0xc2, 0x40, 0xb0, 0xb6, 0x90, 0xdc, 0x93, 0xac, 0x37, + 0xb2, 0x97, 0x30, 0x86, 0x93, 0xc6, 0x78, 0xa1, 0x80, 0x34, 0xc1, 0x9d, 0x24, 0x30, 0xba, 0x19, + 0xcd, 0x37, 0x54, 0x3e, 0x81, 0x7c, 0x9c, 0x8a, 0x14, 0x20, 0x57, 0x3f, 0x3a, 0x5a, 0xd7, 0x88, + 0x05, 0x46, 0xfd, 0xa8, 0x41, 0x5b, 0xeb, 0x3a, 0x01, 0x30, 0x69, 0x63, 0xff, 0x3b, 0x7a, 0xb0, + 0xbe, 0x54, 0xf9, 0x09, 0x56, 0x93, 0xf7, 0x53, 0x01, 0xc8, 0xa7, 0x60, 0xf4, 0x78, 0x38, 0x8c, + 0xf0, 0x14, 0xcb, 0xbb, 0x1f, 0xcd, 0x9e, 0xe2, 0x79, 0x6c, 0x38, 0xd4, 0xa8, 0x42, 0x90, 0x12, + 0x14, 0x7e, 0xf6, 0x78, 0xd0, 0x0f, 0x7a, 0xf8, 0xba, 0xd6, 0xa1, 0x46, 0x53, 0x85, 0x5b, 0x04, + 0x93, 0x33, 0x31, 0xf4, 0x65, 0x65, 0x1f, 0x60, 0xea, 0x2b, 0xc8, 0x13, 0x30, 0xd1, 0x59, 0xd8, + 0xfa, 0x76, 0x6e, 0x6e, 0x7c, 0x17, 0x26, 0x63, 0x27, 0x01, 0xd1, 0x44, 0x56, 0xfe, 0xc8, 0x81, + 0x35, 0x45, 0x90, 0x8f, 0x21, 0x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89, 0x14, 0xe3, 0x36, 0xa6, + 0x1d, 0x49, 0x0d, 0x31, 0xf2, 0x50, 0xa3, 0x19, 0x92, 0x3c, 0x02, 0xc3, 0xf3, 0x19, 0x97, 0xd8, + 0xe3, 0xe5, 0xdd, 0xd5, 0xd4, 0xa5, 0x1e, 0x2b, 0x63, 0x82, 0xa2, 0x75, 0x86, 0x84, 0xbf, 0xe5, + 0x60, 0x15, 0x8d, 0xcd, 0x40, 0x48, 0x2f, 0xe8, 0x32, 0xf2, 0x35, 0x98, 0xbe, 0xd7, 0x61, 0xbe, + 0x48, 0xd2, 0x92, 0xe9, 0x41, 0x79, 0x38, 0x38, 0x42, 0x8b, 0xbb, 0x96, 0x54, 0x32, 0x41, 0xd2, + 0x44, 0x92, 0x26, 0x2c, 0x7b, 0x41, 0x10, 0x4a, 0xac, 0xa1, 0x48, 0x5e, 0x62, 0x5e, 0x80, 0xfb, + 0x49, 0x80, 0x59, 0x38, 0x9d, 0xdd, 0x90, 0x3d, 0x30, 0x84, 0xf4, 0x24, 0xb3, 0x73, 0x58, 0x6e, + 0x72, 0xed, 0x24, 0x27, 0xb1, 0x45, 0x91, 0x12, 0x41, 0x54, 0x09, 0x72, 0x02, 0x96, 0xd7, 0x95, + 0xfd, 0x73, 0xd6, 0xf6, 0x24, 0xb2, 0xf2, 0x0e, 0x42, 0x4c, 0xc6, 0x0e, 0x51, 0x0e, 0x75, 0xf9, + 0x45, 0x38, 0xe8, 0x4b, 0x36, 0x88, 0xe4, 0x08, 0x09, 0x51, 0x4c, 0xf5, 0xc4, 0x01, 0x23, 0xe6, + 0x05, 0x43, 0xa6, 0x5a, 0x2a, 0x2b, 0x2a, 0xa8, 0x12, 0xff, 0xc7, 0x15, 0xf3, 0x43, 0x72, 0xe5, + 0x17, 0x03, 0x0c, 0x2c, 0x47, 0x56, 0x2c, 0xfd, 0x1d, 0x8a, 0x95, 0x0e, 0x8b, 0xa5, 0xb9, 0xc3, + 0xc2, 0x01, 0xe3, 0xd5,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x46, 0x96, 0xa1, 0xf0, 0xa2, 0x71, + 0x7c, 0xd0, 0x3c, 0x7e, 0xae, 0xae, 0x4e, 0xdf, 0x36, 0x69, 0xbc, 0x5e, 0xda, 0xfd, 0x06, 0x0c, + 0xbc, 0x3a, 0x91, 0xa7, 0xe9, 0xe2, 0xc1, 0xbc, 0x2b, 0x5f, 0x69, 0xe3, 0x86, 0x56, 0x8d, 0xb7, + 0x2f, 0x75, 0xf7, 0xd1, 0xc5, 0x3f, 0x65, 0xed, 0xe2, 0xb2, 0xac, 0xbf, 0xb9, 0x2c, 0xeb, 0x7f, + 0x5f, 0x96, 0xf5, 0xd7, 0x57, 0x65, 0xed, 0xcd, 0x55, 0x59, 0xfb, 0xf3, 0xaa, 0xac, 0xfd, 0x50, + 0x48, 0xee, 0xb2, 0x1d, 0x13, 0xeb, 0xb2, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x78, + 0xe7, 0xed, 0xe3, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -930,11 +927,6 @@ func (m *RuleGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x40 } - if m.DeprecatedPartialResponseStrategy != 0 { - i = encodeVarintRpc(dAtA, i, uint64(m.DeprecatedPartialResponseStrategy)) - i-- - dAtA[i] = 0x38 - } n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastEvaluation, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation):]) if err2 != nil { return 0, err2 @@ -1455,9 +1447,6 @@ func (m *RuleGroup) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastEvaluation) n += 1 + l + sovRpc(uint64(l)) - if m.DeprecatedPartialResponseStrategy != 0 { - n += 1 + sovRpc(uint64(m.DeprecatedPartialResponseStrategy)) - } if m.PartialResponseStrategy != 0 { n += 1 + sovRpc(uint64(m.PartialResponseStrategy)) } @@ -2106,25 +2095,6 @@ func (m *RuleGroup) Unmarshal(dAtA []byte) error { 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 ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DeprecatedPartialResponseStrategy |= storepb.PartialResponseStrategy(b&0x7F) << shift - if b < 0x80 { - break - } - } case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field PartialResponseStrategy", wireType) diff --git a/pkg/rules/rulespb/rpc.proto b/pkg/rules/rulespb/rpc.proto index 66557714f7..eec6daedbd 100644 --- a/pkg/rules/rulespb/rpc.proto +++ b/pkg/rules/rulespb/rpc.proto @@ -73,7 +73,6 @@ message RuleGroup { 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" ]; } diff --git a/pkg/testutil/testpromcompatibility/api_compatibility.go b/pkg/testutil/testpromcompatibility/api_compatibility.go index a42b28dda5..ecf357f8bb 100644 --- a/pkg/testutil/testpromcompatibility/api_compatibility.go +++ b/pkg/testutil/testpromcompatibility/api_compatibility.go @@ -4,6 +4,7 @@ package testpromcompatibility import ( + "encoding/json" "time" "github.com/prometheus/prometheus/pkg/labels" @@ -24,8 +25,17 @@ type RuleGroup struct { EvaluationTime float64 `json:"evaluationTime"` LastEvaluation time.Time `json:"lastEvaluation"` - DeprecatedPartialResponseStrategy string `json:"partial_response_strategy"` - PartialResponseStrategy string `json:"partialResponseStrategy"` + PartialResponseStrategy string `json:"partialResponseStrategy"` +} + +// https://github.com/prometheus/prometheus/blob/c530b4b456cc5f9ec249f771dff187eb7715dc9b/web/api/v1/api.go#L1016 +// MarshalJSON marshals a rulegroup while ensuring that `rules' is always non-empty. +func (r *RuleGroup) MarshalJSON() ([]byte, error) { + if r.Rules == nil { + r.Rules = make([]Rule, 0) + } + type plain RuleGroup + return json.Marshal((*plain)(r)) } type Rule interface{} diff --git a/test/e2e/rule_test.go b/test/e2e/rule_test.go index 8b22bd3576..ba9b244fbe 100644 --- a/test/e2e/rule_test.go +++ b/test/e2e/rule_test.go @@ -29,6 +29,7 @@ import ( http_util "github.com/thanos-io/thanos/pkg/http" "github.com/thanos-io/thanos/pkg/promclient" "github.com/thanos-io/thanos/pkg/query" + "github.com/thanos-io/thanos/pkg/rules/rulespb" "github.com/thanos-io/thanos/pkg/runutil" "github.com/thanos-io/thanos/pkg/testutil" "github.com/thanos-io/thanos/test/e2e/e2ethanos" @@ -98,9 +99,37 @@ func reloadRulesHTTP(t *testing.T, ctx context.Context, endpoint string) { testutil.Ok(t, err) resp, err := http.DefaultClient.Do(req) testutil.Ok(t, err) + defer resp.Body.Close() testutil.Equals(t, 200, resp.StatusCode) } +func rulegroupCorrectData(t *testing.T, ctx context.Context, endpoint string) { + req, err := http.NewRequestWithContext(ctx, "GET", "http://"+endpoint+"/api/v1/rules", ioutil.NopCloser(bytes.NewReader(nil))) + testutil.Ok(t, err) + resp, err := http.DefaultClient.Do(req) + testutil.Ok(t, err) + testutil.Equals(t, 200, resp.StatusCode) + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + testutil.Ok(t, err) + + var data struct { + Status string + Data *rulespb.RuleGroups + } + + testutil.Ok(t, json.Unmarshal(body, &data)) + testutil.Equals(t, "success", data.Status) + + testutil.Assert(t, len(data.Data.Groups) > 0, "expected there to be some rule groups") + + for _, g := range data.Data.Groups { + testutil.Assert(t, g.EvaluationDurationSeconds > 0, "expected it to take more than zero seconds to evaluate") + testutil.Assert(t, !g.LastEvaluation.IsZero(), "expected the rule group to be evaluated at least once") + } +} + func writeTargets(t *testing.T, path string, addrs ...string) { t.Helper() @@ -462,6 +491,10 @@ func TestRule(t *testing.T) { testutil.Ok(t, r.WaitSumMetrics(e2e.Equals(1), "thanos_ruler_alertmanagers_dns_provider_results")) }) + t.Run("rule groups have last evaluation and evaluation duration set", func(t *testing.T) { + rulegroupCorrectData(t, ctx, r.HTTPEndpoint()) + }) + t.Run("reload works", func(t *testing.T) { // Add a new rule via /-/reload. // TODO(GiedriusS): add a test for reloading via SIGHUP. Need to extend e2e framework to expose PIDs.