Alerting: Add limits to the Prometheus Rules API (#65169)
This commit adds a number of limits to the Grafana flavor of the Prometheus Rules API: 1. `limit` limits the maximum number of Rule Groups returned 2. `limit_rules` limits the maximum number of rules per Rule Group 3. `limit_alerts` limits the maximum number of alerts per rule It sorts Rule Groups and rules within Rule Groups such that data in the response is stable across requests. It also returns summaries (totals) for all Rule Groups, individual Rule Groups and rules.
This commit is contained in:
@@ -188,6 +188,14 @@ func (ctx *Context) QueryInt64(name string) int64 {
|
||||
return n
|
||||
}
|
||||
|
||||
func (ctx *Context) QueryInt64WithDefault(name string, d int64) int64 {
|
||||
n, err := strconv.ParseInt(ctx.Query(name), 10, 64)
|
||||
if err != nil {
|
||||
return d
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// GetCookie returns given cookie value from request header.
|
||||
func (ctx *Context) GetCookie(name string) string {
|
||||
cookie, err := ctx.Req.Cookie(name)
|
||||
|
||||
Reference in New Issue
Block a user