From 1134ecf350e74ee95a80c5fd127d07b89d36dafa Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Thu, 5 Sep 2024 11:11:32 +0900 Subject: [PATCH] Support peakSamples in query frontend response Signed-off-by: SungJin1212 --- CHANGELOG.md | 1 + .../instantquery/instant_query_test.go | 33 +-- pkg/querier/tripperware/merge.go | 3 + pkg/querier/tripperware/query.pb.go | 189 +++++++++++------- pkg/querier/tripperware/query.proto | 1 + .../queryrange/query_range_test.go | 53 ++++- .../tripperware/test_shard_by_query_utils.go | 42 ++-- 7 files changed, 213 insertions(+), 109 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f72d5b4e0b2..10356a2563a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## master / unreleased * [FEATURE] Ruler: Minimize chances of missed rule group evaluations that can occur due to OOM kills, bad underlying nodes, or due to an unhealthy ruler that appears in the ring as healthy. This feature is enabled via `-ruler.enable-ha-evaluation` flag. #6129 +* [ENHANCEMENT] Query Frontend: Add peakSample in query stats response. #6188 * [ENHANCEMENT] Ruler: Add new ruler metric `cortex_ruler_rule_groups_in_store` that is the total rule groups per tenant in store, which can be used to compare with `cortex_prometheus_rule_group_rules` to count the number of rule groups that are not loaded by a ruler. #5869 * [ENHANCEMENT] Ingester/Ring: New `READONLY` status on ring to be used by Ingester. New ingester API to change mode of ingester #6163 * [ENHANCEMENT] Ruler: Add query statistics metrics when --ruler.query-stats-enabled=true. #6173 diff --git a/pkg/querier/tripperware/instantquery/instant_query_test.go b/pkg/querier/tripperware/instantquery/instant_query_test.go index f1581899a5b..19219c67b16 100644 --- a/pkg/querier/tripperware/instantquery/instant_query_test.go +++ b/pkg/querier/tripperware/instantquery/instant_query_test.go @@ -174,10 +174,10 @@ func TestResponse(t *testing.T) { body: `{"status":"success","data":{"resultType":"string","result":[1,"foo"]}}`, }, { - body: `{"status":"success","data":{"resultType":"string","result":[1,"foo"],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1536673680,5],[1536673780,5]]}}}}`, + body: `{"status":"success","data":{"resultType":"string","result":[1,"foo"],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1536673680,5],[1536673780,5]],"peakSamples":10}}}}`, }, { - body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"foo":"bar"},"values":[[1,"137"],[2,"137"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1536673680,5],[1536673780,5]]}}}}`, + body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"foo":"bar"},"values":[[1,"137"],[2,"137"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1536673680,5],[1536673780,5]],"peakSamples":10}}}}`, }, { body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"foo":"bar"},"values":[[1,"137"],[2,"137"]]}]}}`, @@ -242,8 +242,8 @@ func TestMergeResponse(t *testing.T) { { name: "empty response with stats", req: defaultReq, - resps: []string{`{"status":"success","data":{"resultType":"vector","result":[],"stats":{"samples":{"totalQueryableSamples":0,"totalQueryableSamplesPerStep":[]}}}}`}, - expectedResp: `{"status":"success","data":{"resultType":"vector","result":[],"stats":{"samples":{"totalQueryableSamples":0,"totalQueryableSamplesPerStep":[]}}}}`, + resps: []string{`{"status":"success","data":{"resultType":"vector","result":[],"stats":{"samples":{"totalQueryableSamples":0,"totalQueryableSamplesPerStep":[],"peakSamples":0}}}}`}, + expectedResp: `{"status":"success","data":{"resultType":"vector","result":[],"stats":{"samples":{"totalQueryableSamples":0,"totalQueryableSamplesPerStep":[],"peakSamples":0}}}}`, }, { name: "single response", @@ -254,8 +254,8 @@ func TestMergeResponse(t *testing.T) { { name: "single response with stats", req: defaultReq, - resps: []string{`{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`}, - expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + resps: []string{`{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`}, + expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, { name: "duplicated response", @@ -276,10 +276,10 @@ func TestMergeResponse(t *testing.T) { name: "duplicated response with stats", req: defaultReq, resps: []string{ - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, - expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]]}}}}`, + expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]],"peakSamples":10}}}}`, }, { name: "merge two responses", @@ -366,10 +366,19 @@ func TestMergeResponse(t *testing.T) { name: "merge two responses with stats", req: defaultReq, resps: []string{ - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, - expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]]}}}}`, + expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]],"peakSamples":10}}}}`, + }, + { + name: "merge two responses with stats, the peak samples should be larger one among the responses", + req: defaultReq, + resps: []string{ + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":15}}}}`, + }, + expectedResp: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]],"peakSamples":15}}}}`, }, { name: "responses don't contain vector, should return an error", diff --git a/pkg/querier/tripperware/merge.go b/pkg/querier/tripperware/merge.go index 6266946b4a2..44c4dcbd75c 100644 --- a/pkg/querier/tripperware/merge.go +++ b/pkg/querier/tripperware/merge.go @@ -211,6 +211,7 @@ func vectorMerge(ctx context.Context, req Request, resps []*PrometheusResponse) func statsMerge(shouldSumStats bool, resps []*PrometheusResponse) *PrometheusResponseStats { output := map[int64]*PrometheusResponseQueryableSamplesStatsPerStep{} hasStats := false + var peakSamples int64 for _, resp := range resps { if resp.Data.Stats == nil { continue @@ -232,6 +233,7 @@ func statsMerge(shouldSumStats bool, resps []*PrometheusResponse) *PrometheusRes output[s.GetTimestampMs()] = s } } + peakSamples = max(peakSamples, resp.Data.Stats.Samples.PeakSamples) } if !hasStats { @@ -249,6 +251,7 @@ func statsMerge(shouldSumStats bool, resps []*PrometheusResponse) *PrometheusRes result.Samples.TotalQueryableSamplesPerStep = append(result.Samples.TotalQueryableSamplesPerStep, output[key]) result.Samples.TotalQueryableSamples += output[key].Value } + result.Samples.PeakSamples = peakSamples return result } diff --git a/pkg/querier/tripperware/query.pb.go b/pkg/querier/tripperware/query.pb.go index 84c1c406bd3..d21f9732dfe 100644 --- a/pkg/querier/tripperware/query.pb.go +++ b/pkg/querier/tripperware/query.pb.go @@ -567,6 +567,7 @@ func (m *PrometheusResponseStats) GetSamples() *PrometheusResponseSamplesStats { type PrometheusResponseSamplesStats struct { TotalQueryableSamples int64 `protobuf:"varint,1,opt,name=totalQueryableSamples,proto3" json:"totalQueryableSamples"` TotalQueryableSamplesPerStep []*PrometheusResponseQueryableSamplesStatsPerStep `protobuf:"bytes,2,rep,name=totalQueryableSamplesPerStep,proto3" json:"totalQueryableSamplesPerStep"` + PeakSamples int64 `protobuf:"varint,3,opt,name=peakSamples,proto3" json:"peakSamples"` } func (m *PrometheusResponseSamplesStats) Reset() { *m = PrometheusResponseSamplesStats{} } @@ -615,6 +616,13 @@ func (m *PrometheusResponseSamplesStats) GetTotalQueryableSamplesPerStep() []*Pr return nil } +func (m *PrometheusResponseSamplesStats) GetPeakSamples() int64 { + if m != nil { + return m.PeakSamples + } + return 0 +} + type PrometheusResponseQueryableSamplesStatsPerStep struct { Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"` @@ -978,81 +986,82 @@ func init() { func init() { proto.RegisterFile("query.proto", fileDescriptor_5c6ac9b241082464) } var fileDescriptor_5c6ac9b241082464 = []byte{ - // 1173 bytes of a gzipped FileDescriptorProto + // 1189 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4b, 0x6f, 0x1b, 0xd5, 0x17, 0xf7, 0xf8, 0x31, 0x71, 0x8e, 0xd3, 0xa4, 0xff, 0x9b, 0x3e, 0x9c, 0xfe, 0xcb, 0x8c, 0x19, - 0x81, 0x14, 0x04, 0x71, 0xa4, 0x20, 0xa8, 0x00, 0xa9, 0x22, 0x03, 0x81, 0x50, 0x28, 0x49, 0x6f, - 0xa2, 0x22, 0xb1, 0xa9, 0xae, 0xed, 0x8b, 0x33, 0xc4, 0xe3, 0x99, 0xde, 0xb9, 0xd3, 0xc4, 0xac, - 0xf8, 0x04, 0x88, 0x0d, 0x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, 0x73, 0x51, 0xfe, 0x1f, 0x89, 0xfd, 0x52, 0x63, 0xad, 0xec, - 0xd7, 0x3b, 0x24, 0xe4, 0x94, 0x89, 0x7b, 0xf7, 0x29, 0x67, 0x5e, 0x1b, 0xeb, 0x78, 0xe8, 0x7d, - 0x98, 0x89, 0x64, 0x26, 0x19, 0xf3, 0xd7, 0xc7, 0xa1, 0x55, 0x8a, 0xe3, 0x96, 0x79, 0x46, 0x7a, - 0x31, 0x8d, 0x70, 0x66, 0x80, 0x76, 0x01, 0xf6, 0xbc, 0x88, 0x07, 0x5d, 0x46, 0x7c, 0xd1, 0x38, - 0xc2, 0xbc, 0x31, 0x71, 0x71, 0xca, 0xc3, 0x66, 0x06, 0x92, 0x65, 0x20, 0xed, 0x2e, 0x67, 0x8b, - 0x73, 0xdf, 0xce, 0x77, 0xb0, 0x38, 0xc5, 0x0c, 0xbd, 0x0a, 0x73, 0xdc, 0xf3, 0x69, 0xc4, 0x89, - 0x1f, 0x3e, 0xf1, 0xd5, 0x02, 0x2a, 0xe1, 0xda, 0x48, 0xf6, 0x30, 0x42, 0x1f, 0xc2, 0xec, 0xc8, - 0x8f, 0x1e, 0x89, 0xbb, 0x97, 0xa5, 0xe3, 0x96, 0x45, 0x2a, 0x78, 0x6c, 0xe4, 0x3c, 0x85, 0x85, - 0x33, 0x18, 0x74, 0x03, 0x2a, 0xed, 0x20, 0xee, 0xab, 0x7e, 0x32, 0xb0, 0x3a, 0xa0, 0xeb, 0x50, - 0x8a, 0x62, 0x15, 0xc4, 0xc0, 0xe2, 0x13, 0xbd, 0x0b, 0x33, 0xad, 0xb8, 0xbd, 0x4f, 0x79, 0xc6, - 0xc4, 0x64, 0xe8, 0x71, 0x50, 0x09, 0xc2, 0x19, 0xd8, 0x89, 0x60, 0xe1, 0x8c, 0x0e, 0x59, 0x00, - 0xad, 0x20, 0xee, 0x77, 0x08, 0xf3, 0xa8, 0x2a, 0xb4, 0x82, 0x73, 0x12, 0x91, 0x52, 0x2f,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0x00, 0xff, 0xff, 0xaa, 0xc5, 0x91, - 0xf0, 0x53, 0x0b, 0x00, 0x00, + 0x81, 0x14, 0x04, 0x71, 0x44, 0x10, 0x54, 0x80, 0x54, 0x91, 0x81, 0x40, 0x28, 0x94, 0xa4, 0x37, + 0x51, 0x91, 0xd8, 0x54, 0xd7, 0xf6, 0xc5, 0x19, 0xe2, 0xf1, 0x4c, 0xef, 0xdc, 0x69, 0x62, 0x56, + 0x7c, 0x02, 0xc4, 0x1a, 0x89, 0x05, 0x3b, 0x16, 0x7c, 0x90, 0x2c, 0xb3, 0xac, 0x90, 0x18, 0x88, + 0xb3, 0x41, 0xb3, 0xea, 0x47, 0x40, 0xf7, 0x31, 0xf6, 0x38, 0x71, 0x12, 0x75, 0xc5, 0xc6, 0x99, + 0x73, 0xce, 0xef, 0x3c, 0xef, 0x79, 0x04, 0x6a, 0x4f, 0x63, 0xca, 0x06, 0xcd, 0x90, 0x05, 0x3c, + 0x40, 0x35, 0xce, 0xbc, 0x30, 0xa4, 0xec, 0x80, 0x30, 0x7a, 0xe7, 0x46, 0x37, 0xe8, 0x06, 0x92, + 0xbf, 0x2a, 0xbe, 0x14, 0xe4, 0x8e, 0xd5, 0x0d, 0x82, 0x6e, 0x8f, 0xae, 0x4a, 0xaa, 0x15, 0x7f, + 0xbb, 0xda, 0x89, 0x19, 0xe1, 0x5e, 0xd0, 0xd7, 0xf2, 0xa5, 0xb3, 0x72, 0xd2, 0xd7, 0xd6, 0xef, + 0xbc, 0xdf, 0xf5, 0xf8, 0x5e, 0xdc, 0x6a, 0xb6, 0x03, 0x7f, 0xb5, 0x1d, 0x30, 0x4e, 0x0f, 0x43, + 0x16, 0x7c, 0x47, 0xdb, 0x5c, 0x53, 0xab, 0xe1, 0x7e, 0x37, 0x13, 0xb4, 0xf4, 0x87, 0x52, 0x75, + 0xfe, 0x2a, 0x02, 0xda, 0x66, 0x81, 0x4f, 0xf9, 0x1e, 0x8d, 0x23, 0x4c, 0xa3, 0x30, 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xac, + 0x9c, 0x18, 0x58, 0x7c, 0xa2, 0xf7, 0x60, 0xa6, 0x15, 0xb7, 0xf7, 0x29, 0xcf, 0x2a, 0x31, 0xe9, + 0x7a, 0xec, 0x54, 0x82, 0x70, 0x06, 0x76, 0x22, 0x58, 0x38, 0x23, 0x43, 0x16, 0x40, 0x2b, 0x88, + 0xfb, 0x1d, 0xc2, 0x3c, 0xaa, 0x12, 0xad, 0xe0, 0x1c, 0x47, 0x84, 0xd4, 0x0b, 0x0e, 0x28, 0xd3, + 0xee, 0x15, 0x21, 0xb8, 0xb1, 0x70, 0x27, 0x27, 0xd8, 0xc0, 0x8a, 0x18, 0x87, 0x5f, 0xce, 0x85, + 0xef, 0xf8, 0x70, 0xfb, 0x82, 0x99, 0x46, 0x78, 0xdc, 0x10, 0x86, 0x2c, 0xe1, 0x9b, 0x57, 0xad, + 0x02, 0x85, 0x56, 0x1b, 0xa1, 0x26, 0xc6, 0x53, 0xeb, 0x8f, 0x1a, 0xc5, 0x39, 0x2a, 0x82, 0x75, + 0xb9, 0x22, 0xda, 0x82, 0x9b, 0x3c, 0xe0, 0xa4, 0x27, 0x77, 0x15, 0x69, 0xf5, 0x32, 0xa9, 0x1e, + 0xe3, 0xa5, 0x34, 0xb1, 0xa7, 0x03, 0xf0, 0x74, 0x36, 0xfa, 0xd5, 0x80, 0xbb, 0x53, 0x25, 0xdb, + 0x94, 0xed, 0x70, 0x1a, 0xea, 0x76, 0xff, 0xf0, 0x8a, 0xec, 0xce, 0x6a, 0xcb, 0x68, 0xb5, 0x09, + 0xb7, 0x91, 0x26, 0xf6, 0xa5, 0x4e, 0xf0, 0xa5, 0x52, 0xf4, 0x36, 0xd4, 0x42, 0x4a, 0xf6, 0xb3, + 0x54, 0x4b, 0x32, 0xd5, 0x85, 0x34, 0xb1, 0xf3, 0x6c, 0x9c, 0x27, 0x1c, 0x0f, 0x5e, 0x32, 0x48, + 0xd1, 0x01, 0x72, 0x70, 0xf5, 0xc4, 0x28, 0xe2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, 0xc7, 0x27, + 0x56, 0xe1, 0xf9, 0x89, 0x55, 0x78, 0x71, 0x62, 0x19, 0x3f, 0x0c, 0x2d, 0xe3, 0xb7, 0xa1, 0x65, + 0x1c, 0x0d, 0x2d, 0xe3, 0x78, 0x68, 0x19, 0x7f, 0x0f, 0x2d, 0xe3, 0x9f, 0xa1, 0x55, 0x78, 0x31, + 0xb4, 0x8c, 0x9f, 0x4e, 0xad, 0xc2, 0xf1, 0xa9, 0x55, 0x78, 0x7e, 0x6a, 0x15, 0xbe, 0xc9, 0xff, + 0x8f, 0xdd, 0x32, 0xe5, 0x95, 0x7e, 0xe7, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x64, 0x1e, 0xe3, + 0x30, 0x86, 0x0b, 0x00, 0x00, } func (this *PrometheusResponse) Equal(that interface{}) bool { @@ -1393,6 +1402,9 @@ func (this *PrometheusResponseSamplesStats) Equal(that interface{}) bool { return false } } + if this.PeakSamples != that1.PeakSamples { + return false + } return true } func (this *PrometheusResponseQueryableSamplesStatsPerStep) Equal(that interface{}) bool { @@ -1790,12 +1802,13 @@ func (this *PrometheusResponseSamplesStats) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 6) + s := make([]string, 0, 7) s = append(s, "&tripperware.PrometheusResponseSamplesStats{") s = append(s, "TotalQueryableSamples: "+fmt.Sprintf("%#v", this.TotalQueryableSamples)+",\n") if this.TotalQueryableSamplesPerStep != nil { s = append(s, "TotalQueryableSamplesPerStep: "+fmt.Sprintf("%#v", this.TotalQueryableSamplesPerStep)+",\n") } + s = append(s, "PeakSamples: "+fmt.Sprintf("%#v", this.PeakSamples)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -2387,6 +2400,11 @@ func (m *PrometheusResponseSamplesStats) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.PeakSamples != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PeakSamples)) + i-- + dAtA[i] = 0x18 + } if len(m.TotalQueryableSamplesPerStep) > 0 { for iNdEx := len(m.TotalQueryableSamplesPerStep) - 1; iNdEx >= 0; iNdEx-- { { @@ -2921,6 +2939,9 @@ func (m *PrometheusResponseSamplesStats) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.PeakSamples != 0 { + n += 1 + sovQuery(uint64(m.PeakSamples)) + } return n } @@ -3211,6 +3232,7 @@ func (this *PrometheusResponseSamplesStats) String() string { s := strings.Join([]string{`&PrometheusResponseSamplesStats{`, `TotalQueryableSamples:` + fmt.Sprintf("%v", this.TotalQueryableSamples) + `,`, `TotalQueryableSamplesPerStep:` + repeatedStringForTotalQueryableSamplesPerStep + `,`, + `PeakSamples:` + fmt.Sprintf("%v", this.PeakSamples) + `,`, `}`, }, "") return s @@ -4652,6 +4674,25 @@ func (m *PrometheusResponseSamplesStats) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PeakSamples", wireType) + } + m.PeakSamples = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PeakSamples |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/pkg/querier/tripperware/query.proto b/pkg/querier/tripperware/query.proto index c2eb585cb3f..0bac43c6c32 100644 --- a/pkg/querier/tripperware/query.proto +++ b/pkg/querier/tripperware/query.proto @@ -74,6 +74,7 @@ message PrometheusResponseStats { message PrometheusResponseSamplesStats { int64 totalQueryableSamples = 1 [(gogoproto.jsontag) = "totalQueryableSamples"]; repeated PrometheusResponseQueryableSamplesStatsPerStep totalQueryableSamplesPerStep = 2 [(gogoproto.jsontag) = "totalQueryableSamplesPerStep"]; + int64 peakSamples = 3 [(gogoproto.jsontag) = "peakSamples"]; } message PrometheusResponseQueryableSamplesStatsPerStep { diff --git a/pkg/querier/tripperware/queryrange/query_range_test.go b/pkg/querier/tripperware/queryrange/query_range_test.go index 32db902c0f6..476b07186b7 100644 --- a/pkg/querier/tripperware/queryrange/query_range_test.go +++ b/pkg/querier/tripperware/queryrange/query_range_test.go @@ -156,7 +156,7 @@ func TestResponseWithStats(t *testing.T) { expected *tripperware.PrometheusResponse }{ { - body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"foo":"bar"},"values":[[1536673680,"137"],[1536673780,"137"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1536673680,5],[1536673780,5]]}}}}`, + body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"foo":"bar"},"values":[[1536673680,"137"],[1536673780,"137"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1536673680,5],[1536673780,5]],"peakSamples":16}}}}`, expected: &tripperware.PrometheusResponse{ Status: "success", Data: tripperware.PrometheusData{ @@ -185,6 +185,7 @@ func TestResponseWithStats(t *testing.T) { {Value: 5, TimestampMs: 1536673680000}, {Value: 5, TimestampMs: 1536673780000}, }, + PeakSamples: 16, }, }, }, @@ -883,6 +884,54 @@ func TestMergeAPIResponses(t *testing.T) { }}, }, }, + }, { + name: "[stats] Peak samples should be the largest one among the responses", + input: []tripperware.Response{ + mustParse(t, `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"a":"b","c":"d"},"values":[[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[2,2],[3,3]],"peakSamples":20}}}}`), + mustParse(t, `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"c":"d","a":"b"},"values":[[2,"2"],[3,"3"],[4,"4"],[5,"5"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[2,2],[3,3],[4,4],[5,5]],"peakSamples":22}}}}`), + mustParse(t, `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"c":"d","a":"b"},"values":[[6,"6"],[7,"7"],[8,"8"],[9,"9"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[6,6],[7,7],[8,8],[9,9]],"peakSamples":25}}}}`), + }, + expected: &tripperware.PrometheusResponse{ + Status: StatusSuccess, + Data: tripperware.PrometheusData{ + ResultType: matrix, + Result: tripperware.PrometheusQueryResult{ + Result: &tripperware.PrometheusQueryResult_Matrix{ + Matrix: &tripperware.Matrix{ + SampleStreams: []tripperware.SampleStream{ + { + Labels: []cortexpb.LabelAdapter{{Name: "a", Value: "b"}, {Name: "c", Value: "d"}}, + Samples: []cortexpb.Sample{ + {Value: 2, TimestampMs: 2000}, + {Value: 3, TimestampMs: 3000}, + {Value: 4, TimestampMs: 4000}, + {Value: 5, TimestampMs: 5000}, + {Value: 6, TimestampMs: 6000}, + {Value: 7, TimestampMs: 7000}, + {Value: 8, TimestampMs: 8000}, + {Value: 9, TimestampMs: 9000}, + }, + }, + }, + }, + }, + }, + Stats: &tripperware.PrometheusResponseStats{Samples: &tripperware.PrometheusResponseSamplesStats{ + TotalQueryableSamples: 44, + TotalQueryableSamplesPerStep: []*tripperware.PrometheusResponseQueryableSamplesStatsPerStep{ + {Value: 2, TimestampMs: 2000}, + {Value: 3, TimestampMs: 3000}, + {Value: 4, TimestampMs: 4000}, + {Value: 5, TimestampMs: 5000}, + {Value: 6, TimestampMs: 6000}, + {Value: 7, TimestampMs: 7000}, + {Value: 8, TimestampMs: 8000}, + {Value: 9, TimestampMs: 9000}, + }, + PeakSamples: 25, + }}, + }, + }, }} { tc := tc t.Run(tc.name, func(t *testing.T) { @@ -911,7 +960,7 @@ func TestGzippedResponse(t *testing.T) { err error }{ { - body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"a":"b","c":"d"},"values":[[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[2,2],[3,3]]}}}}`, + body: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"a":"b","c":"d"},"values":[[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[2,2],[3,3]],"peakSamples":10}}}}`, status: 200, }, { diff --git a/pkg/querier/tripperware/test_shard_by_query_utils.go b/pkg/querier/tripperware/test_shard_by_query_utils.go index 2fbd2a48c57..1c8c0c1d40a 100644 --- a/pkg/querier/tripperware/test_shard_by_query_utils.go +++ b/pkg/querier/tripperware/test_shard_by_query_utils.go @@ -302,10 +302,10 @@ http_requests_total`, shardingLabels: []string{"pod", "cluster_name"}, shardSize: 2, responses: []string{ - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"a"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]]}}}}`, - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"b"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]]}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"a"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]],"peakSamples":6}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"b"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]],"peakSamples":7}}}}`, }, - response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]},{"metric":{"__job__":"b","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":12,"totalQueryableSamplesPerStep":[[1,2],[2,4],[3,6]]}}}}`, + response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]},{"metric":{"__job__":"b","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":12,"totalQueryableSamplesPerStep":[[1,2],[2,4],[3,6]],"peakSamples":7}}}}`, }, { name: "should shard instant query when query is shardable", @@ -315,10 +315,10 @@ http_requests_total`, shardingLabels: []string{"pod", "cluster_name"}, isShardable: true, responses: []string{ - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":11}}}}`, }, - response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]]}}}}`, + response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]],"peakSamples":11}}}}`, }, { name: "should not shard if shard size is 1", @@ -327,9 +327,9 @@ http_requests_total`, shardSize: 1, isShardable: false, responses: []string{ - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, - response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, } for _, query := range nonShardable { @@ -340,9 +340,9 @@ http_requests_total`, shardSize: 2, isShardable: false, responses: []string{ - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, - response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, expectedErr: query.expectedErr, }) tests = append(tests, testCase{ @@ -352,9 +352,9 @@ http_requests_total`, shardSize: 2, isShardable: false, responses: []string{ - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]]}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]],"peakSamples":6}}}}`, }, - response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]]}}}}`, + response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]],"peakSamples":6}}}}`, expectedErr: query.expectedErr, }) } @@ -368,10 +368,10 @@ http_requests_total`, shardSize: 2, shardingLabels: query.shardingLabels, responses: []string{ - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, - `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, + `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, }, - response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]]}}}}`, + response: `{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","job":"bar"},"value":[2,"2"]},{"metric":{"__name__":"up","job":"foo"},"value":[1,"1"]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]],"peakSamples":10}}}}`, expectedErr: query.expectedErr, }) tests = append(tests, testCase{ @@ -382,10 +382,10 @@ http_requests_total`, shardSize: 2, shardingLabels: query.shardingLabels, responses: []string{ - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"a"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]]}}}}`, - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"b"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]]}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"a"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]],"peakSamples":6}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"metric","__job__":"b"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":6,"totalQueryableSamplesPerStep":[[1,1],[2,2],[3,3]],"peakSamples":7}}}}`, }, - response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]},{"metric":{"__job__":"b","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":12,"totalQueryableSamplesPerStep":[[1,2],[2,4],[3,6]]}}}}`, + response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__job__":"a","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]},{"metric":{"__job__":"b","__name__":"metric"},"values":[[1,"1"],[2,"2"],[3,"3"]]}],"stats":{"samples":{"totalQueryableSamples":12,"totalQueryableSamplesPerStep":[[1,2],[2,4],[3,6]],"peakSamples":7}}}}`, expectedErr: query.expectedErr, }) } @@ -399,10 +399,10 @@ http_requests_total`, shardSize: 2, shardingLabels: query.shardingLabels, responses: []string{ - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"foo"},"values":[[1,"1"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, - `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"bar"},"values":[[2,"2"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]]}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"foo"},"values":[[1,"1"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":10}}}}`, + `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"bar"},"values":[[2,"2"]]}],"stats":{"samples":{"totalQueryableSamples":10,"totalQueryableSamplesPerStep":[[1,10]],"peakSamples":11}}}}`, }, - response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"bar"},"values":[[2,"2"]]},{"metric":{"__name__":"up","job":"foo"},"values":[[1,"1"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]]}}}}`, + response: `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"__name__":"up","job":"bar"},"values":[[2,"2"]]},{"metric":{"__name__":"up","job":"foo"},"values":[[1,"1"]]}],"stats":{"samples":{"totalQueryableSamples":20,"totalQueryableSamplesPerStep":[[1,20]],"peakSamples":11}}}}`, }) }