Hello, when creating alerts from exceptions, is i...
# support
Hello, when creating alerts from exceptions, is it possible to create labels that have a link to source exception and error message?
@Amol Umbark Do you have more insights here?
@Salman Alert labels allows dynamic links to be created from columns that you select in the query. But let me check on exceptions page and get back. Currently, we add a top level link "/exceptions" as source link in the alert.
@Salman You can use labels to form the alert query. We support the following options to dynamically create labels. example: {{.Labels.serviceName}} or {{$labels.serviceName}} The error details page has the following format. so you can select the params groupId, timestamp and errorId in the query and pass it in the label. https://<<signoz-url>>/error-detail?&groupId=0fa408c2591sdfsdfds3r2d2&timestamp=71654055292&errorId=23f3r3f434f34r4 eventually, the label in alert would look like this: source: https//&lt;&lt;enter signoz hostport>>/error-detail?&groupId={{$labels.groupid}}&timestamp={{$labels.errTimestamp}}&errorId={{$labels.errorId}} for above to work your query should have columns groupId, errTimestamp and errorId If you need help with query @Vishal Sharma can help
Thank you Amol!@Vishal Sharma could you please help me writing the query that would give more info about the exception/error?
@Salman can you pls share your existing query for the alert
I have figured it out by connecting to clickhouse and looking at db schema. This is the query:
Copy code
	count() over(partition by serviceName) as value,
	toStartOfInterval(timestamp, toIntervalMinute(1)) AS interval,
  groupID groupId,
  errorID errorId,
  traceID traceId,
  spanID spanId,
  exceptionMessage message,
  exceptionStacktrace stacktrace,
FROM signoz_traces.distributed_signoz_error_index_v2
WHERE exceptionType = 'error'
-- WHERE exceptionType = 'warning'
AND timestamp BETWEEN {{.start_datetime}} AND {{.end_datetime}};
hopefully, this could help someone else
Exception urls are in this format:
is go nanoseconds. Timestamp stored in db is in this format:
2023-02-03 02:03:08.279049
By default, the value of
in alert payload drops milliseconds. For example,
2023-02-03 02:03:08.279049
2023-02-03 02:03:08
. I suppose, you need to convert
to go nanoseconds. I am not sure if there is a function that you could apply in go template to get that value.