Alerting: Remove internal labels from prometheus compatible API responses (#46548)

* Alerting: Remove internal labels from prometheus compatible API responses

* Appease the linter

* Fix integration tests

* Fix API documentation & linter

* move removal of internal labels to the models
This commit is contained in:
gotjosh
2022-03-16 16:04:19 +00:00
committed by GitHub
parent d5883c1b27
commit a338c78ca8
11 changed files with 290 additions and 5735 deletions
@@ -297,14 +297,6 @@ type GetSilencesParams struct {
Filter []string `json:"filter"`
}
// swagger:parameters RouteGetRuleStatuses RouteGetGrafanaRuleStatuses
type GetRuleStatusesParams struct {
// in: query
DashboardUID string
// in: query
PanelID int64
}
// swagger:model
type GettableStatus struct {
// cluster
@@ -115,10 +115,10 @@ type Rule struct {
Name string `json:"name"`
// required: true
Query string `json:"query"`
Labels overrideLabels `json:"labels"`
Labels overrideLabels `json:"labels,omitempty"`
// required: true
Health string `json:"health"`
LastError string `json:"lastError"`
LastError string `json:"lastError,omitempty"`
// required: true
Type v1.RuleType `json:"type"`
LastEvaluation time.Time `json:"lastEvaluation"`
@@ -142,3 +142,31 @@ type Alert struct {
// override the labels type with a map for generation.
// The custom marshaling for labels.Labels ends up doing this anyways.
type overrideLabels map[string]string
// swagger:parameters RouteGetGrafanaAlertStatuses
type GetGrafanaAlertStatusesParams struct {
// Include Grafana specific labels as part of the response.
// in: query
// required: false
// default: false
IncludeInternalLabels bool `json:"includeInternalLabels"`
}
// swagger:parameters RouteGetGrafanaRuleStatuses
type GetGrafanaRuleStatusesParams struct {
// Include Grafana specific labels as part of the response.
// in: query
// required: false
// default: false
IncludeInternalLabels bool `json:"includeInternalLabels"`
// Filter the list of rules to those that belong to the specified dashboard UID.
// in: query
// required: false
DashboardUID string
// Filter the list of rules to those that belong to the specified panel ID. Dashboard UID must be specified.
// in: query
// required: false
PanelID int64
}