Dependency call stack and Application Insights SDK labs
We have released an experimental package to trace the stack for every dependency call collected by Visual Studio Application Insights. With the existing SDK for .NET, you can track calls from your app to external dependencies such as databases or REST APIs, and find slow or failing calls. But with the current SDK, you can’t easily find out which functions in your app made the calls. Our experimental package, NuGet, addresses this problem. This project extends the Application Insights SDK for .NET to provide call stack information for every dependency collected.
- An ASP.NET web application project
- Application Insights SDK for .NET Web Applications installed in the project (this is the SDK you get if you use Visual Studio to add Application Insights to your project)
Our SDK adds one custom property to each dependency telemetry data point.
The dependency call stack package is hosted in the new SDK Labs NuGet gallery. If you’re using Visual Studio to manage NuGet package in your project, here’s what to do:
- Add the Application Insights SDK Labs package source to NuGet.
- Add the prerelease package Microsoft.ApplicationInsights.DependencyCallstacks to your project. Remember to include prerelease packages.
- That’s it! Re-build and run your app.
If you are using the command line package manager this is all you need:
> Install-Package "Microsoft.ApplicationInsights.DependencyCallstacks" -Source "https://www.myget.org/F/applicationinsights-sdk-labs/" -Pre
Viewing Call Stacks
Using this experiment will change your experience in the Azure Portal to support this new data. When you view requests in Application Insights that have related dependencies you will now get a view showing the relationship between your dependencies.
Click on any dependency in this new view to bring up the dependency details blade. It now contains a call stack section complete with class and function names as well as filenames and line numbers, when available.
To stop getting this experimental experience, remove the package from your project. After you remove the package from your project all new requests will be displayed in the default UI on the Azure Portal. Old requests made when the package was installed will continue to be displayed in the view above.
- Some asynchronously called dependencies may not have call stack information collected.
- Only the “Just My Code” version of the call stack is collected.
About SDK Labs
- Every experimental project is a standalone NuGet package.
- Publish projects to the dedicated MyGet feed.
- Monitor number of downloads and engaged customers using the experimental feature.
- Decide if the experiment is successful. If it doesn’t prove beneficial, we will discontinue this project and remove it from the repository.
- Promote successful projects to their own repository or into Application Insights SDK.
This project enables some extra diagnostics scenarios. It improves Application Insights by providing more details and increasing functionality of an existing feature. We believe this addition will be very useful. The package was created as an intern project, and we hope it will gain interest so we can include it into our SDK my default.
Please help us evaluate this feature by providing your feedback on GitHub: https://github.com/Microsoft/ApplicationInsights-SDK-Labs
Want more features? Ask us.
I would like to thank the author of this package, Osvaldo Rosado for preparing this blog post.
Source: Microsoft Azure News