Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Jun 10, 2024
1 parent 4f0fb6a commit 963dee8
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions internal/checks/alerts_external_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ func (c AlertsExternalLabelsCheck) Check(ctx context.Context, _ discovery.Path,

if rule.AlertingRule.Labels != nil {
for _, label := range rule.AlertingRule.Labels.Items {
for _, name := range checkExternalLabels(label.Key.Value, label.Key.Value, cfg.Config.Global.ExternalLabels) {
problems = append(problems, Problem{
Lines: parser.LineRange{
First: label.Key.Lines.First,
Last: label.Value.Lines.Last,
},
Reporter: c.Reporter(),
Text: fmt.Sprintf("Template is using `%s` external label but %s doesn't have this label configured in global:external_labels.", name, promText(c.prom.Name(), cfg.URI)),
Details: fmt.Sprintf("[Click here](%s/config) to see `%s` Prometheus runtime configuration.", cfg.URI, c.prom.Name()),
Severity: Bug,
})
}
for _, name := range checkExternalLabels(label.Key.Value, label.Value.Value, cfg.Config.Global.ExternalLabels) {
problems = append(problems, Problem{
Lines: parser.LineRange{
Expand All @@ -94,18 +82,6 @@ func (c AlertsExternalLabelsCheck) Check(ctx context.Context, _ discovery.Path,

if rule.AlertingRule.Annotations != nil {
for _, annotation := range rule.AlertingRule.Annotations.Items {
for _, name := range checkExternalLabels(annotation.Key.Value, annotation.Key.Value, cfg.Config.Global.ExternalLabels) {
problems = append(problems, Problem{
Lines: parser.LineRange{
First: annotation.Key.Lines.First,
Last: annotation.Value.Lines.Last,
},
Reporter: c.Reporter(),
Text: fmt.Sprintf("Template is using `%s` external label but %s doesn't have this label configured in global:external_labels.", name, promText(c.prom.Name(), cfg.URI)),
Details: fmt.Sprintf("[Click here](%s/config) to see `%s` Prometheus runtime configuration.", cfg.URI, c.prom.Name()),
Severity: Bug,
})
}
for _, name := range checkExternalLabels(annotation.Key.Value, annotation.Value.Value, cfg.Config.Global.ExternalLabels) {
problems = append(problems, Problem{
Lines: parser.LineRange{
Expand Down

0 comments on commit 963dee8

Please sign in to comment.