ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

Captured stack traces do not benefit from improvements to async stack traces added in .NET Core 2.1

Open ascott18 opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Async stack traces captured by App Insights are messy and hard to read. Significant improvements have been made in this area on the .NET side of things, but the .NET AI SDK appears to have extensively custom code for capturing exception stack traces that does not benefit from these .NET improvements.

See:

  • https://github.com/dotnet/runtime/issues/23837
  • https://github.com/dotnet/coreclr/pull/14652
  • https://github.com/dotnet/coreclr/pull/14655
  • https://github.com/dotnet/coreclr/pull/15781

Describe the solution you'd like. Stack traces captured by AI have async state machine noise removed as is the case in exception.ToString() in .NET Core 2.1+

ascott18 avatar Apr 16 '21 20:04 ascott18

Is there any update on this issue? It would be nice to get better stack traces.

GrantErickson avatar Aug 06 '21 17:08 GrantErickson

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Jun 03 '22 00:06 github-actions[bot]

unstale

ascott18 avatar Jun 04 '22 03:06 ascott18

@ascott18 Were you looking to see if ApplicationInsights SDK can simply do ex.ToString() and send the result as stack?

The OpenTelemetry based solution is doing this - i.e ex.ToString() following the OpenTelemetry convention. It is coming up as a preview release early October.

cijothomas avatar Sep 16 '22 21:09 cijothomas

@cijothomas I'm looking for all the extra async noise to not be included in the call stack.

Example of a typical app Insights call stack: image

exception.StackTrace from an exception I just triggered (first picture, the same as what App Insights uses), versus exception.ToString() (second picture) for the same exception which excludes all of that noise: image image

See how enormously more readable the second stack trace is? That's what I'd love to be reading through when I'm looking at exceptions in app insights, as opposed to the first one.

ascott18 avatar Sep 17 '22 01:09 ascott18

@ascott18 Thanks for confirming! Yes that will be the case with the OpenTelemetry based solution. We are not actively making new features/fixes to this repo, so its unlikely to get that fixed here. Would be great if you can use the preview version of OpenTelemetry based solution, and share any feedback! Thanks!

cijothomas avatar Sep 17 '22 04:09 cijothomas

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Jul 15 '23 00:07 github-actions[bot]