I want to get profile information about the startup times in my app (in production) and have the app send that information to Application Insights every time the app starts up.
I have a ASP.NET MVC (dotnet 8) app, currently running on Azure Websites / Azure App Service. I want to get wall clock startup times for milestones during the startup process and record that information in Application Insights, if possible.
At a high level, I’m aware of the different periods of a dotnet app starting up such as the dotnet runtime compiling various DLLs/dependencies from IL to machine code, among other things I’m sure. Then later my app starts and runs the Startup function where various activities happen that I have pretty good visibility into.
I want to record startup performance telemetry of my app in such a way that I can go back over time and answer questions such as:
- How often does my app get restarted?
- How long did my app take to start up before serving its first request?
- What is the breakdown of the time taken for different parts of the startup process?
- How has this data changed over time? [The most important question!]
But I’m not aware of any way to profile the startup performance of the app while the runtime is doing JIT compiling, etc. Stuff that happens before the first line of my code runs. Is there any way to get this information? I’m also looking for examples of where someone may have already created a comprehensive solution around logging ASP.NET startup performance in a production environment.