Alerting: Use consts from alerting package (#61241)

This commit is contained in:
George Robinson
2023-01-10 19:59:13 +00:00
committed by GitHub
parent 2505f112f5
commit 2a291afbae
7 changed files with 31 additions and 35 deletions
+6 -16
View File
@@ -12,6 +12,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
alertingModels "github.com/grafana/alerting/alerting/models"
"github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/util/cmputil"
)
@@ -89,17 +90,9 @@ const (
)
const (
RuleUIDLabel = "__alert_rule_uid__"
NamespaceUIDLabel = "__alert_rule_namespace_uid__"
// Annotations are actually a set of labels, so technically this is the label name of an annotation.
DashboardUIDAnnotation = "__dashboardUid__"
PanelIDAnnotation = "__panelId__"
OrgIDAnnotation = "__orgId__"
// This isn't a hard-coded secret token, hence the nolint.
//nolint:gosec
ImageTokenAnnotation = "__alertImageToken__"
// GrafanaReservedLabelPrefix contains the prefix for Grafana reserved labels. These differ from "__<label>__" labels
// in that they are not meant for internal-use only and will be passed-through to AMs and available to users in the same
@@ -111,9 +104,6 @@ const (
// StateReasonAnnotation is the name of the annotation that explains the difference between evaluation state and alert state (i.e. changing state when NoData or Error).
StateReasonAnnotation = GrafanaReservedLabelPrefix + "state_reason"
ValuesAnnotation = "__values__"
ValueStringAnnotation = "__value_string__"
)
const (
@@ -124,13 +114,13 @@ const (
var (
// InternalLabelNameSet are labels that grafana automatically include as part of the labelset.
InternalLabelNameSet = map[string]struct{}{
RuleUIDLabel: {},
NamespaceUIDLabel: {},
alertingModels.RuleUIDLabel: {},
alertingModels.NamespaceUIDLabel: {},
}
InternalAnnotationNameSet = map[string]struct{}{
DashboardUIDAnnotation: {},
PanelIDAnnotation: {},
ImageTokenAnnotation: {},
DashboardUIDAnnotation: {},
PanelIDAnnotation: {},
alertingModels.ImageTokenAnnotation: {},
}
)