mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
add limit to the rules api (#10152)
This commit is contained in:
parent
eb7c10dbbd
commit
2f4289a3bf
|
@ -620,6 +620,7 @@ $ curl http://localhost:9090/api/v1/rules
|
||||||
],
|
],
|
||||||
"file": "/rules.yaml",
|
"file": "/rules.yaml",
|
||||||
"interval": 60,
|
"interval": 60,
|
||||||
|
"limit": 0,
|
||||||
"name": "example"
|
"name": "example"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1164,6 +1164,7 @@ type RuleGroup struct {
|
||||||
// same array.
|
// same array.
|
||||||
Rules []Rule `json:"rules"`
|
Rules []Rule `json:"rules"`
|
||||||
Interval float64 `json:"interval"`
|
Interval float64 `json:"interval"`
|
||||||
|
Limit int `json:"limit"`
|
||||||
EvaluationTime float64 `json:"evaluationTime"`
|
EvaluationTime float64 `json:"evaluationTime"`
|
||||||
LastEvaluation time.Time `json:"lastEvaluation"`
|
LastEvaluation time.Time `json:"lastEvaluation"`
|
||||||
}
|
}
|
||||||
|
@ -1216,6 +1217,7 @@ func (api *API) rules(r *http.Request) apiFuncResult {
|
||||||
Name: grp.Name(),
|
Name: grp.Name(),
|
||||||
File: grp.File(),
|
File: grp.File(),
|
||||||
Interval: grp.Interval().Seconds(),
|
Interval: grp.Interval().Seconds(),
|
||||||
|
Limit: grp.Limit(),
|
||||||
Rules: []Rule{},
|
Rules: []Rule{},
|
||||||
EvaluationTime: grp.GetEvaluationTime().Seconds(),
|
EvaluationTime: grp.GetEvaluationTime().Seconds(),
|
||||||
LastEvaluation: grp.GetLastEvaluation(),
|
LastEvaluation: grp.GetLastEvaluation(),
|
||||||
|
|
|
@ -1470,6 +1470,7 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
|
||||||
Name: "grp",
|
Name: "grp",
|
||||||
File: "/path/to/file",
|
File: "/path/to/file",
|
||||||
Interval: 1,
|
Interval: 1,
|
||||||
|
Limit: 0,
|
||||||
Rules: []Rule{
|
Rules: []Rule{
|
||||||
AlertingRule{
|
AlertingRule{
|
||||||
State: "inactive",
|
State: "inactive",
|
||||||
|
@ -1516,6 +1517,7 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
|
||||||
Name: "grp",
|
Name: "grp",
|
||||||
File: "/path/to/file",
|
File: "/path/to/file",
|
||||||
Interval: 1,
|
Interval: 1,
|
||||||
|
Limit: 0,
|
||||||
Rules: []Rule{
|
Rules: []Rule{
|
||||||
AlertingRule{
|
AlertingRule{
|
||||||
State: "inactive",
|
State: "inactive",
|
||||||
|
@ -1555,6 +1557,7 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
|
||||||
Name: "grp",
|
Name: "grp",
|
||||||
File: "/path/to/file",
|
File: "/path/to/file",
|
||||||
Interval: 1,
|
Interval: 1,
|
||||||
|
Limit: 0,
|
||||||
Rules: []Rule{
|
Rules: []Rule{
|
||||||
RecordingRule{
|
RecordingRule{
|
||||||
Name: "recording-rule-1",
|
Name: "recording-rule-1",
|
||||||
|
|
Loading…
Reference in a new issue