PerfView: ASP.NET Core Stats View by info.odysseyx@gmail.com August 23, 2024 written by info.odysseyx@gmail.com August 23, 2024 0 comment 16 views 16 This is something I created earlier this year and was merged into the PerfView main source in mid-April and released in v3.1.10. It’s a view built to be consumed. Microsoft.AspNetCore.Hosting Displays EventSource events and similar pages. IIS Statistics This is a view for those familiar with that view. If there is an event in the trace opened in PerfView, you can use the statistics view. If there is no event in the trace, the view will not be displayed. Additionally, over the past few months, the Azure App Service product group has been revising Diagnostics as a Service (DaaS). .NET Profiler This is a trace to automatically collect these events from Linux and Windows App Services. This means that recent App Service traces (within the last month or so) will contain the events, so when you open the trace in PerfView, the view should be available. Where are you? When you open a trace containing the aforementioned events in PerfView v3.1.10+, a new view is exposed in the Advanced folder. What does it look like? Fortunately, no matter what type of trace you look at, it all looks the same. That’s from dotnet-trace, which I pulled from one of my Linux app services via the .NET profiler (actually, this profiler just uses the pre-configured dotnet-trace command). Here’s something from a Windows App Service, captured via .NET Profiler (it comes as a ZIP file, unzip it so you can open the .diagsession file in PerfView): Additional notes on Windows App Service profiler traces – these are saved as ZIP files. You will need to extract the zip so that PerfView can access the .diagsession file inside. When viewing .diagsession in PerfView, There are unresolved bugs If the screen does not refresh: So, double clicking doesn’t give you the option to expand the trace (i.e. the arrow above doesn’t appear). If you refresh the window by pressing F5, the arrow will appear. Here you can extend the trace as shown in the screenshot previously. So what about non-AppService scenarios? You can capture events by adding “events” using PerfView.*Microsoft.AspNetCore.Hosting” Provider from GUI or command line(Note the asterisk * – It is important that PerfView can capture .NET/Core event sources. Command line: PerfView.exe “/DataFile:PerfViewData.etl” /BufferSizeMB:512 /StackCompression /CircularMB:500 /Providers:”*Microsoft.AspNetCore.Hosting,Microsoft-Windows-IIS,*Microsoft-Extensions-Logging:4:5″ /ContinueOnError /NoGui /NoNGenRundown Collect Or capture using dotnet-trace (no need for leading asterisk): dotnet-trace collection –provider Microsoft.AspNetCore.Hosting,Microsoft-Extensions-Logging:4:5 -p ### What if I’m interested in a specific request? Clicking on the ActivityId of a given request will open an Events view showing that ID as a text filter and the start and end times of the event depending on the request (all events are selected by default). The first event on that list is: Microsoft.AspNetCore.Hosting/Request/Start – The last one should apply. Request/Stop Assuming the event is included in the trace. You will also see other events that contain that ActivityId. You can then filter these events as you normally would (e.g. by removing other types you are not interested in) to see exactly what you want to see. I’ve used this view several times already, as it saves me a lot of clicks when looking for specific requests etc. I hope it helps you too! If you capture your own traces, it’s a good idea to include: Microsoft-Extended-Logging:4:5 Provider (yes, it’s a dash and if you’re capturing using PerfView, don’t forget the asterisk in front, otherwise it’s the same) is where ASP.NET Core itself writes its logs, as well as everything else that uses ILogger. These events are sometimes unavailable for various reasons, but when they are available, they’re usually helpful. 4 The provider is a keyword and for that provider it means capture only. Formatted message While the event is in progress 5 is detailed (5=detailed). Reference: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-8.0#dotnet-trace… As time goes by and I have time, I plan to adjust the view and add more features. Related Links: Original PR: https://github.com/microsoft/perfview/pull/2001 Added clickable ActivityId to fetch event view. https://github.com/microsoft/perfview/pull/2028 This feature was first released in PerfView 3.1.10 release: https://github.com/microsoft/perfview/releases/tag/v3.1.10 Latest PerfView release (currently 3.1.13): https://github.com/microsoft/perfview/releases/latest Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post Data Classification and Labelling in Azure SQL Database | Data Exposed next post Enhancing Disaster Recovery and Ransomware Protection with Azure VMware Solution and JetStream You may also like 7 Disturbing Tech Trends of 2024 December 19, 2024 AI on phones fails to impress Apple, Samsung users: Survey December 18, 2024 Standout technology products of 2024 December 16, 2024 Is Intel Equivalent to Tech Industry 2024 NY Giant? December 12, 2024 Google’s Willow chip marks breakthrough in quantum computing December 11, 2024 Job seekers are targeted in mobile phishing campaigns December 10, 2024 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.