()
| 2473 | } |
| 2474 | |
| 2475 | func (i *Ingester) trackInflightQueryRequest() (func(), error) { |
| 2476 | gl := i.getInstanceLimits() |
| 2477 | if gl != nil && gl.MaxInflightQueryRequests > 0 { |
| 2478 | if i.inflightQueryRequests.Load() >= gl.MaxInflightQueryRequests { |
| 2479 | return nil, errTooManyInflightQueryRequests |
| 2480 | } |
| 2481 | } |
| 2482 | |
| 2483 | i.maxInflightQueryRequests.Track(i.inflightQueryRequests.Inc()) |
| 2484 | |
| 2485 | if i.resourceBasedLimiter != nil { |
| 2486 | if err := i.resourceBasedLimiter.AcceptNewRequest(); err != nil { |
| 2487 | level.Warn(i.logger).Log("msg", "failed to accept request", "err", err) |
| 2488 | return nil, limiter.ErrResourceLimitReached |
| 2489 | } |
| 2490 | } |
| 2491 | |
| 2492 | return func() { |
| 2493 | i.inflightQueryRequests.Dec() |
| 2494 | }, nil |
| 2495 | } |
| 2496 | |
| 2497 | func isRegexUnOptimized(matcher *labels.Matcher) bool { |
| 2498 | if matcher.Type != labels.MatchRegexp { |
no test coverage detected