Skip to content

Change ingester to return 400 instead of 429 on series/metadata limits. #3833

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

Merged
merged 2 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [CHANGE] Require explicit flag `-<prefix>.tls-enabled` to enable TLS in GRPC clients. Previously it was enough to specify a TLS flag to enable TLS validation. #3156
* [CHANGE] Query-frontend: removed `-querier.split-queries-by-day` (deprecated in Cortex 0.4.0). You should use `-querier.split-queries-by-interval` instead. #3813
* [CHANGE] Store-gateway: the chunks pool controlled by `-blocks-storage.bucket-store.max-chunk-pool-bytes` is now shared across all tenants. #3830
* [CHANGE] Ingester: return error code 400 instead of 429 when per-user/per-tenant series/metadata limits are reached. #3833
* [FEATURE] Adds support to S3 server side encryption using KMS. Deprecated `-<prefix>.s3.sse-encryption`, you should use the following CLI flags that have been added. #3651 #3810
- `-<prefix>.s3.sse.type`
- `-<prefix>.s3.sse.kms-key-id`
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func makeLimitError(errorType string, err error) error {
return &validationError{
errorType: errorType,
err: err,
code: http.StatusTooManyRequests,
code: http.StatusBadRequest,
}
}

Expand All @@ -44,7 +44,7 @@ func makeMetricLimitError(errorType string, labels labels.Labels, err error) err
return &validationError{
errorType: errorType,
err: err,
code: http.StatusTooManyRequests,
code: http.StatusBadRequest,
labels: labels,
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func TestIngesterUserLimitExceeded(t *testing.T) {
testLimits := func() {
// Append to two series, expect series-exceeded error.
_, err = ing.Push(ctx, client.ToWriteRequest([]labels.Labels{labels1, labels3}, []client.Sample{sample2, sample3}, nil, client.API))
if resp, ok := httpgrpc.HTTPResponseFromError(err); !ok || resp.Code != http.StatusTooManyRequests {
if resp, ok := httpgrpc.HTTPResponseFromError(err); !ok || resp.Code != http.StatusBadRequest {
t.Fatalf("expected error about exceeding metrics per user, got %v", err)
}
// Append two metadata, expect no error since metadata is a best effort approach.
Expand Down Expand Up @@ -698,7 +698,7 @@ func TestIngesterMetricLimitExceeded(t *testing.T) {
testLimits := func() {
// Append two series, expect series-exceeded error.
_, err = ing.Push(ctx, client.ToWriteRequest([]labels.Labels{labels1, labels3}, []client.Sample{sample2, sample3}, nil, client.API))
if resp, ok := httpgrpc.HTTPResponseFromError(err); !ok || resp.Code != http.StatusTooManyRequests {
if resp, ok := httpgrpc.HTTPResponseFromError(err); !ok || resp.Code != http.StatusBadRequest {
t.Fatalf("expected error about exceeding series per metric, got %v", err)
}

Expand Down