Skip to content

Commit 081be7e

Browse files
committed
rename metric label values for fetched-data limit rejections
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
1 parent 8b3f7bc commit 081be7e

3 files changed

Lines changed: 32 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

33
## master / unreleased
4+
* [CHANGE] Query Frontend: Rename `cortex_rejected_queries_total` metric label `reason` values for fetched-data limit rejections. #7517
5+
* Old values: `series_fetched`, `chunks_fetched`, `chunk_bytes_fetched`, `data_bytes_fetched`.
6+
* New values: `fetched_series_exceeded`, `fetched_chunks_exceeded`, `fetched_chunk_bytes_exceeded`, `fetched_data_bytes_exceeded`.
47
* [CHANGE] Querier: Make query time range configurations per-tenant: `query_ingesters_within`, `query_store_after`, and `shuffle_sharding_ingesters_lookback_period`. Uses `model.Duration` instead of `time.Duration` to support serialization but has minimum unit of 1ms (nanoseconds/microseconds not supported). #7160
58
* [CHANGE] Cache: Setting `-blocks-storage.bucket-store.metadata-cache.bucket-index-content-ttl` to 0 will disable the bucket-index cache. #7446
69
* [CHANGE] HA Tracker: Move `-distributor.ha-tracker.failover-timeout` from a global config to a per-tenant runtime config. The flag name and default value (30s) remain the same. #7481

pkg/frontend/transport/handler.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ var (
4949
)
5050

5151
const (
52-
reasonTooManyTenants = "too_many_tenants"
53-
reasonRequestBodySizeExceeded = "request_body_size_exceeded"
54-
reasonResponseBodySizeExceeded = "response_body_size_exceeded"
55-
reasonTooManyRequests = "too_many_requests"
56-
reasonResourceExhausted = "resource_exhausted"
57-
reasonTimeRangeExceeded = "time_range_exceeded"
58-
reasonResponseSizeExceeded = "response_size_exceeded"
59-
reasonTooManySamples = "too_many_samples"
60-
reasonSeriesFetched = "series_fetched"
61-
reasonChunksFetched = "chunks_fetched"
62-
reasonChunkBytesFetched = "chunk_bytes_fetched"
63-
reasonDataBytesFetched = "data_bytes_fetched"
64-
reasonSeriesLimitStoreGateway = "store_gateway_series_limit"
65-
reasonChunksLimitStoreGateway = "store_gateway_chunks_limit"
66-
reasonBytesLimitStoreGateway = "store_gateway_bytes_limit"
67-
reasonUnOptimizedRegexMatcher = `unoptimized_regex_matcher`
68-
reasonQueryTooExpensive = "query_too_expensive"
52+
reasonTooManyTenants = "too_many_tenants"
53+
reasonRequestBodySizeExceeded = "request_body_size_exceeded"
54+
reasonResponseBodySizeExceeded = "response_body_size_exceeded"
55+
reasonTooManyRequests = "too_many_requests"
56+
reasonResourceExhausted = "resource_exhausted"
57+
reasonTimeRangeExceeded = "time_range_exceeded"
58+
reasonResponseSizeExceeded = "response_size_exceeded"
59+
reasonTooManySamples = "too_many_samples"
60+
reasonFetchedSeriesExceeded = "fetched_series_exceeded"
61+
reasonFetchedChunksExceeded = "fetched_chunks_exceeded"
62+
reasonFetchedChunkBytesExceeded = "fetched_chunk_bytes_exceeded"
63+
reasonFetchedDataBytesExceeded = "fetched_data_bytes_exceeded"
64+
reasonSeriesLimitStoreGateway = "store_gateway_series_limit"
65+
reasonChunksLimitStoreGateway = "store_gateway_chunks_limit"
66+
reasonBytesLimitStoreGateway = "store_gateway_bytes_limit"
67+
reasonUnOptimizedRegexMatcher = `unoptimized_regex_matcher`
68+
reasonQueryTooExpensive = "query_too_expensive"
6969

7070
limitTooManySamples = `query processing would load too many samples into memory`
7171
limitTimeRangeExceeded = `the query time range exceeds the limit`
@@ -579,13 +579,13 @@ func (f *Handler) reportQueryStats(r *http.Request, source, userID string, query
579579
} else if strings.Contains(errMsg, limitResponseSizeExceeded) {
580580
reason = reasonResponseSizeExceeded
581581
} else if strings.Contains(errMsg, limitSeriesFetched) {
582-
reason = reasonSeriesFetched
582+
reason = reasonFetchedSeriesExceeded
583583
} else if strings.Contains(errMsg, limitChunksFetched) {
584-
reason = reasonChunksFetched
584+
reason = reasonFetchedChunksExceeded
585585
} else if strings.Contains(errMsg, limitChunkBytesFetched) {
586-
reason = reasonChunkBytesFetched
586+
reason = reasonFetchedChunkBytesExceeded
587587
} else if strings.Contains(errMsg, limitDataBytesFetched) {
588-
reason = reasonDataBytesFetched
588+
reason = reasonFetchedDataBytesExceeded
589589
} else if strings.Contains(errMsg, limitSeriesStoreGateway) {
590590
reason = reasonSeriesLimitStoreGateway
591591
} else if strings.Contains(errMsg, limitChunksStoreGateway) {

pkg/frontend/transport/handler_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func TestHandler_ServeHTTP(t *testing.T) {
272272
expectedStatusCode: http.StatusUnprocessableEntity,
273273
},
274274
{
275-
name: "test handler with reasonSeriesFetched",
275+
name: "test handler with reasonFetchedSeriesExceeded",
276276
cfg: HandlerConfig{QueryStatsEnabled: true},
277277
expectedMetrics: 6,
278278
roundTripperFunc: roundTripperFunc(func(req *http.Request) (*http.Response, error) {
@@ -282,13 +282,13 @@ func TestHandler_ServeHTTP(t *testing.T) {
282282
}, nil
283283
}),
284284
additionalMetricsCheckFunc: func(h *Handler) {
285-
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonSeriesFetched, requestmeta.SourceAPI, userID))
285+
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonFetchedSeriesExceeded, requestmeta.SourceAPI, userID))
286286
assert.Equal(t, float64(1), v)
287287
},
288288
expectedStatusCode: http.StatusUnprocessableEntity,
289289
},
290290
{
291-
name: "test handler with reasonChunksFetched",
291+
name: "test handler with reasonFetchedChunksExceeded",
292292
cfg: HandlerConfig{QueryStatsEnabled: true},
293293
expectedMetrics: 6,
294294
roundTripperFunc: roundTripperFunc(func(req *http.Request) (*http.Response, error) {
@@ -298,13 +298,13 @@ func TestHandler_ServeHTTP(t *testing.T) {
298298
}, nil
299299
}),
300300
additionalMetricsCheckFunc: func(h *Handler) {
301-
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonChunksFetched, requestmeta.SourceAPI, userID))
301+
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonFetchedChunksExceeded, requestmeta.SourceAPI, userID))
302302
assert.Equal(t, float64(1), v)
303303
},
304304
expectedStatusCode: http.StatusUnprocessableEntity,
305305
},
306306
{
307-
name: "test handler with reasonChunkBytesFetched",
307+
name: "test handler with reasonFetchedChunkBytesExceeded",
308308
cfg: HandlerConfig{QueryStatsEnabled: true},
309309
expectedMetrics: 6,
310310
roundTripperFunc: roundTripperFunc(func(req *http.Request) (*http.Response, error) {
@@ -314,13 +314,13 @@ func TestHandler_ServeHTTP(t *testing.T) {
314314
}, nil
315315
}),
316316
additionalMetricsCheckFunc: func(h *Handler) {
317-
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonChunkBytesFetched, requestmeta.SourceAPI, userID))
317+
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonFetchedChunkBytesExceeded, requestmeta.SourceAPI, userID))
318318
assert.Equal(t, float64(1), v)
319319
},
320320
expectedStatusCode: http.StatusUnprocessableEntity,
321321
},
322322
{
323-
name: "test handler with reasonDataBytesFetched",
323+
name: "test handler with reasonFetchedDataBytesExceeded",
324324
cfg: HandlerConfig{QueryStatsEnabled: true},
325325
expectedMetrics: 6,
326326
roundTripperFunc: roundTripperFunc(func(req *http.Request) (*http.Response, error) {
@@ -330,7 +330,7 @@ func TestHandler_ServeHTTP(t *testing.T) {
330330
}, nil
331331
}),
332332
additionalMetricsCheckFunc: func(h *Handler) {
333-
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonDataBytesFetched, requestmeta.SourceAPI, userID))
333+
v := promtest.ToFloat64(h.rejectedQueries.WithLabelValues(reasonFetchedDataBytesExceeded, requestmeta.SourceAPI, userID))
334334
assert.Equal(t, float64(1), v)
335335
},
336336
expectedStatusCode: http.StatusUnprocessableEntity,

0 commit comments

Comments
 (0)