Today I integrate my Azure function with Application insight for application logging, especially to capture error stack-trace.
First I have written Azure function wi
Success check denotes whether your Azure Function call succeeded (= no exception thrown) or failed (= exception thrown).
At your first invocation, an exception occurred, so function invocation didn't terminate normally, thus red checkmark.
When you catch and return 500 manually, that's still OK in terms of function invocation - it finished and returned the result back.
Functions runtime doesn't follow HTTP semantics, the rules are universal for all trigger types.
Application Insight Default metrics won't show handled exception in failed request graph, Developer need build query for handled exception e.g.
requests
| where success == "False" and timestamp >= ago(7d)
| join kind= inner traces on operation_Id
| project operation_Id , timestamp, message, severityLevel
| order by timestamp, operation_Id
severityLevel :- 1 = Info and 3 = Error