Evgeny Lundberg
06/04/2025, 12:07 PMcount (.value)
not part of alert message ? Count = NULL
RESULT ON SLACK:
AlertName: ALERT: Hangfire Job Exception (scheduler services)_TEST_ALERT
Service: Company.Project.App.Scheduler
Message: Element 'SomeItems' does not match any field or property of class Company.Project.App.Something
exceptionType: FormatException
Count:
Definied metric:
SELECT
count() AS value,
toStartOfInterval(timestamp, toIntervalMinute(1)) AS interval,
serviceName,
exceptionType,
exceptionMessage
FROM signoz_traces.distributed_signoz_error_index_v2
WHERE exceptionType != 'OSError'
AND serviceName ILIKE '%scheduler%'
AND timestamp BETWEEN {{.start_datetime}} AND {{.end_datetime}}
GROUP BY serviceName, interval, exceptionType, exceptionMessage;
Alert configuration:
labels:
alertname: "SchedulerExceptionAlert"
serviceName: "{{ .serviceName }}"
exceptionMessage: "{{.exceptionMessage}}"
exceptionType: "{{.exceptionType}}"
count: "{{.value}}"
Alert template:
{{ range .Alerts -}}
*AlertName:* {{ .Labels.alertname}}
*Service:* {{ .Labels.serviceName }}
*Message:* {{ .Labels.exceptionMessage}}
*exceptionType:* {{ .Labels.exceptionType}}
*Count:* {{ .Labels.count}}
{{ end }}