mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 11:20:27 -06:00
19ebb079ba
This commit adds support for limits and filters to the Prometheus Rules API. Limits: It adds a number of limits to the Grafana flavour of the Prometheus Rules API: - `limit` limits the maximum number of Rule Groups returned - `limit_rules` limits the maximum number of rules per Rule Group - `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. Filters: Alerts can be filtered by state with the `state` query string. An example of an HTTP request asking for just firing alerts might be `/api/prometheus/grafana/api/v1/rules?state=alerting`. A request can filter by two or more states by adding additional `state` query strings to the URL. For example `?state=alerting&state=normal`. Like the alert list panel, the `firing`, `pending` and `normal` state are first compared against the state of each alert rule. All other states are ignored. If the alert rule matches then its alert instances are filtered against states once more. Alerts can also be filtered by labels using the `matcher` query string. Like `state`, multiple matchers can be provided by adding additional `matcher` query strings to the URL. The match expression should be parsed using existing regular expression and sent to the API as URL-encoded JSON in the format: { "name": "test", "value": "value1", "isRegex": false, "isEqual": true } The `isRegex` and `isEqual` options work as follows: | IsEqual | IsRegex | Operator | | ------- | -------- | -------- | | true | false | = | | true | true | =~ | | false | true | !~ | | false | false | != | |
||
---|---|---|
.. | ||
api | ||
build | ||
bus | ||
cmd | ||
codegen | ||
components | ||
cuectx | ||
events | ||
expr | ||
extensions | ||
ifaces/gcsifaces | ||
infra | ||
kinds | ||
kindsysreport | ||
login | ||
middleware | ||
mocks/mock_gcsifaces | ||
models | ||
modules | ||
plugins | ||
registry | ||
server | ||
services | ||
setting | ||
tests | ||
tsdb | ||
util | ||
web | ||
README.md | ||
ruleguard.rules.go |
This directory contains the code for the Grafana backend.
The contributor documentation for Grafana's backend is in /contribute/backend/README.md.