Skip to content

Commit

Permalink
ignore prometheus buddy in the remote-write-controller (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBisson authored Jun 19, 2024
1 parent f05f47c commit 326fc61
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Internal rework to remove the use generic resource to ease out the migration to Mimir.
- Update generic resource so we can delete resources when mimir is enabled.
- Remove legacy prometheus resources when Mimir is enabled.
- Ignore the prometheus-to-grafana-cloud prometheus in the remove write controller.
- Change Alert link to point to Mimir alerting UI when Mimir is enabled.
- Rename Prometheus link to Source

Expand Down
2 changes: 1 addition & 1 deletion pkg/remotewriteutils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func FetchPrometheusList(ctx context.Context, r *ResourceWrapper, rw *pmov1alpha
ignoreAgentExp := metav1.LabelSelectorRequirement{
Key: "app.kubernetes.io/name",
Operator: metav1.LabelSelectorOpNotIn,
Values: []string{"prometheus-agent"},
Values: []string{"prometheus-agent", "prometheus-remotewrite"},
}
specSelector.MatchExpressions = append(specSelector.MatchExpressions, ignoreAgentExp)
selector, err := metav1.LabelSelectorAsSelector(specSelector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}
{{ define "__queryurl" }}{{ (index .Alerts 0).GeneratorURL }}{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}
{{ define "__queryurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}
{{ define "__queryurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}
{{ define "__queryurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}
{{ define "__queryurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}
{{ define "__queryurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ define "__alertmanagerurl" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}&silenced=false&inhibited=false&active=true&filter=%7Balertname%3D%22{{ .CommonLabels.alertname }}%22%7D{{ end }}
{{ define "__dashboardurl" -}}{{ if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard }}{{ else }}https://grafana/d/{{ (index .Alerts 0).Annotations.dashboard }}{{ end }}{{- end }}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
{{ define "__prometheusurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}
{{ define "__queryurl" }}https://grafana/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{end}}

{{ define "slack.default.title" }}{{ .Status | toUpper }}[{{ if eq .Status "firing" }}{{ .Alerts.Firing | len }}{{- else }}{{ .Alerts.Resolved | len }}{{- end }}] {{ (index .Alerts 0).Labels.alertname }} - Team {{ (index .Alerts 0).Labels.team }}{{ end }}
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
Expand Down Expand Up @@ -42,7 +42,7 @@
{{ if (index .Alerts 0).Annotations.dashboard -}}
πŸ“ˆ Dashboard: {{ template "__dashboardurl" . }}
{{ end -}}
πŸ‘€ Query: {{ template "__prometheusurl" . }}
πŸ‘€ Query: {{ template "__queryurl" . }}

---

Expand Down
Loading

0 comments on commit 326fc61

Please sign in to comment.