Sascha Grossenbacher
06/05/2025, 7:15 AMNagesh Bansal
06/05/2025, 7:24 AMSascha Grossenbacher
06/05/2025, 7:44 AMALERT NAME for (ruleId="0196af92-c498-7b1c-aebe-f5fc9d6676dc", ruleSource="<https://DOMAIN/alerts/edit?ruleId=0196af92-c498-7b1c-aebe-f5fc9d6676dc>", service_name="SERVICE", severity="error")
this is now so long that the service name isn't even visible anymore in a number of places such as chat notificationsSascha Grossenbacher
06/05/2025, 7:46 AMSrikanth Chekuri
06/05/2025, 12:04 PMSrikanth Chekuri
06/05/2025, 12:36 PMSascha Grossenbacher
06/05/2025, 12:36 PMSrikanth Chekuri
06/05/2025, 12:40 PMSascha Grossenbacher
06/05/2025, 12:40 PM{{- if gt (len .CommonLabels) (len .GroupLabels) -}}
{{" "}}(
{{- with .CommonLabels.Remove .GroupLabels.Names }}
{{- range $index, $label := .SortedPairs -}}
{{ if $index }}, {{ end }}
{{- $label.Name }}="{{ $label.Value -}}"
{{- end }}
{{- end -}}
)
{{- end }}
this is the bit in PagerDuty that displays the labels and I only partially understand it. it somehow removes the service_name if there's more than one. I guess I could just start with a condition that ignores the $label if $label.Name is ruleSource, ruleID, that would already help a lotSrikanth Chekuri
06/05/2025, 12:40 PMSrikanth Chekuri
06/05/2025, 12:42 PM{{- if gt (len .CommonLabels) (len .GroupLabels) -}}
{{" "}}(
{{- with .CommonLabels.Remove .GroupLabels.Names }}
{{- range $index, $label := .SortedPairs -}}
{{- if and (ne $label.Name "ruleSource") (ne $label.Name "ruleID") -}}
{{ if $index }}, {{ end }}
{{- $label.Name }}="{{ $label.Value -}}"
{{- end -}}
{{- end }}
{{- end -}}
)
{{- end }}