Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce query response size limit after decompression in query-frontend #6607

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix formatting
Signed-off-by: Ahmed Hassan <[email protected]>
afhassan committed Feb 26, 2025
commit 8d7e83774a3cb2baea0aedd5a2dc4ea86ce96a88
8 changes: 4 additions & 4 deletions pkg/querier/tripperware/instantquery/instant_query_test.go
Original file line number Diff line number Diff line change
@@ -27,10 +27,10 @@ import (
)

var userLimit = validation.Limits{
MaxFetchedSeriesPerQuery: 0,
MaxFetchedSeriesPerQuery: 0,
MaxFetchedChunkBytesPerQuery: 0,
MaxChunksPerQuery: 0,
MaxFetchedDataBytesPerQuery: 0,
MaxChunksPerQuery: 0,
MaxFetchedDataBytesPerQuery: 0,
}
var overrides, _ = validation.NewOverrides(userLimit, nil)
var testInstantQueryCodec = NewInstantQueryCodec(string(tripperware.NonCompression), string(tripperware.ProtobufCodecType), overrides)
@@ -1946,7 +1946,7 @@ func Benchmark_Decode_Protobuf(b *testing.B) {
Header: http.Header{"Content-Type": []string{"application/x-protobuf"}},
Body: io.NopCloser(bytes.NewBuffer(body)),
}

ctx := user.InjectOrgID(context.Background(), "1")
_, err := testInstantQueryCodec.DecodeResponse(ctx, response, nil)
require.NoError(b, err)
6 changes: 3 additions & 3 deletions pkg/querier/tripperware/instantquery/shard_by_query_test.go
Original file line number Diff line number Diff line change
@@ -11,10 +11,10 @@ import (
func Test_shardQuery(t *testing.T) {
t.Parallel()
userLimit := validation.Limits{
MaxFetchedSeriesPerQuery: 0,
MaxFetchedSeriesPerQuery: 0,
MaxFetchedChunkBytesPerQuery: 0,
MaxChunksPerQuery: 0,
MaxFetchedDataBytesPerQuery: 0,
MaxChunksPerQuery: 0,
MaxFetchedDataBytesPerQuery: 0,
}
overrides, _ := validation.NewOverrides(userLimit, nil)
tripperware.TestQueryShardQuery(t, testInstantQueryCodec, queryrange.NewPrometheusCodec(true, "", "protobuf", overrides))
Original file line number Diff line number Diff line change
@@ -22,12 +22,12 @@ import (

var (
userLimit = validation.Limits{
MaxFetchedSeriesPerQuery: 0,
MaxFetchedSeriesPerQuery: 0,
MaxFetchedChunkBytesPerQuery: 0,
MaxChunksPerQuery: 0,
MaxFetchedDataBytesPerQuery: 0,
MaxChunksPerQuery: 0,
MaxFetchedDataBytesPerQuery: 0,
}
overrides, _ = validation.NewOverrides(userLimit, nil)
overrides, _ = validation.NewOverrides(userLimit, nil)
PrometheusCodec = NewPrometheusCodec(false, "", "protobuf", overrides)
ShardedPrometheusCodec = NewPrometheusCodec(false, "", "protobuf", overrides)
)
2 changes: 1 addition & 1 deletion pkg/querier/tripperware/queryrange/query_range_test.go
Original file line number Diff line number Diff line change
@@ -1287,7 +1287,7 @@ func TestCompressedResponse(t *testing.T) {
Header: h,
Body: io.NopCloser(responseBody),
}

ctx := user.InjectOrgID(context.Background(), "1")
resp, err := PrometheusCodec.DecodeResponse(ctx, response, nil)
require.Equal(t, tc.err, err)
Loading