/
errors.go
30 lines (24 loc) · 1.15 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-License-Identifier: AGPL-3.0-only
package querymiddleware
import (
"fmt"
"time"
apierror "github.com/grafana/mimir/pkg/api/error"
"github.com/grafana/mimir/pkg/util/globalerror"
"github.com/grafana/mimir/pkg/util/validation"
)
func newMaxTotalQueryLengthError(actualQueryLen, maxTotalQueryLength time.Duration) error {
return apierror.New(apierror.TypeBadData, globalerror.MaxTotalQueryLength.MessageWithPerTenantLimitConfig(
fmt.Sprintf("the total query time range exceeds the limit (query length: %s, limit: %s)", actualQueryLen, maxTotalQueryLength),
validation.MaxTotalQueryLengthFlag,
))
}
func newMaxQueryExpressionSizeBytesError(actualSizeBytes, maxQuerySizeBytes int) error {
return apierror.New(apierror.TypeBadData, globalerror.MaxQueryExpressionSizeBytes.MessageWithPerTenantLimitConfig(
fmt.Sprintf("the raw query size in bytes exceeds the limit (query size: %d, limit: %d)", actualSizeBytes, maxQuerySizeBytes),
validation.MaxQueryExpressionSizeBytesFlag,
))
}
func newQueryBlockedError() error {
return apierror.New(apierror.TypeBadData, globalerror.QueryBlocked.Message("the request has been blocked by the cluster administrator"))
}