Home NewsX PerfView: ASP.NET Core Stats View

PerfView: ASP.NET Core Stats View

by info.odysseyx@gmail.com
0 comment 16 views


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.

MattHamrick_1-1724426815359.png

What does it look like?

Fortunately, no matter what type of trace you look at, it all looks the same.

MattHamrick_2-1724426859687.png

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):

matthamrick_2-1724422028545.png

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:

matthamrick_3-1724422028546.png

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.

MattHamrick_4-1724422028549.png

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).

matthamrick_3-1724427512708.png

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

You may also like

Leave a Comment

Our Company

Welcome to OdysseyX, your one-stop destination for the latest news and opportunities across various domains.

Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

Laest News

@2024 – All Right Reserved. Designed and Developed by OdysseyX