Azure Application Insights has a table called exceptions
. (In Log Analytics the same table is called AppExceptions
.)
Can I join this table with anything else in order to gain more information about each failure?
I can join exceptions
with requests
on the column operation_Id
. But if I do this as an inner join I lose a lot of exceptions. Not all exceptions match up with a request.
I can also join exceptions
with traces
on either operation_Id
, customDimensions.TraceId
or customDimensions.SpanId
. It is unclear to me what these various IDs are and whether any of them makes sense for this join. And I have not found any really good documentation of it.
Does anyone here know, or can you recommend me some documentation that explains the difference between operation IDs, span IDs, and trace IDs? What are the “correct” ways to join exceptions
with other tables?
Here is an example of a KQL query I am using. It is the best I have so far, but I am not sure whether it gives a proper picture.
traces
| project resultCode = tostring(customDimensions.StatusCode), spanId = tostring(customDimensions.SpanId)
| where resultCode startswith '4'
| summarize arg_max(resultCode, *) by spanId
| join kind = leftouter (
exceptions
| project exceptionType = type, spanId = tostring(customDimensions.SpanId)
) on spanId
| project codeAndType = iff(
isnotempty(exceptionType),
strcat(resultCode, ", ", exceptionType),
strcat(resultCode, ", no exception"))
| summarize
failedCount = count()
by total = codeAndType
| where failedCount > 0
| order by failedCount desc
| render piechart