dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.46k stars 10.03k forks source link

AspNetCore.Hosting counters not getting updated when accessing the webapi #29380

Closed eliassal closed 3 years ago

eliassal commented 3 years ago

Describe the bug

AspNetCore.Hosting counters not getting updated when accessing the webapi

To Reproduce

I created a new webapi from command line and run it from command line (dotnet run). Running

dotnet new webapi --name PerformanceCounters.Demo
dotnet run
dotnet counters monitor -p 14148 Microsoft.AspNetCore.Hosting

I see in the output of the 4 counters in this category added but never get updated when I access the api, only "AllocationRate" in the system.runtime counters category

perfcounters

Further technical details

Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: c:\program files\dotnet\sdk\5.0.102\

Host (useful for support): Version: 5.0.2 Commit: cb5f173b96

.NET SDKs installed: 1.0.0-preview2-003131 [c:\program files\dotnet\sdk] 1.0.0-preview2-1-003177 [c:\program files\dotnet\sdk] 1.0.0 [c:\program files\dotnet\sdk] 1.1.0 [c:\program files\dotnet\sdk] 2.0.2 [c:\program files\dotnet\sdk] 2.1.2 [c:\program files\dotnet\sdk] 2.1.101 [c:\program files\dotnet\sdk] 2.1.200 [c:\program files\dotnet\sdk] 2.1.202 [c:\program files\dotnet\sdk] 2.1.401 [c:\program files\dotnet\sdk] 2.1.500 [c:\program files\dotnet\sdk] 2.1.503 [c:\program files\dotnet\sdk] 2.1.602 [c:\program files\dotnet\sdk] 2.1.802 [c:\program files\dotnet\sdk] 2.2.105 [c:\program files\dotnet\sdk] 2.2.202 [c:\program files\dotnet\sdk] 2.2.203 [c:\program files\dotnet\sdk] 3.1.402 [c:\program files\dotnet\sdk] 5.0.101 [c:\program files\dotnet\sdk] 5.0.102 [c:\program files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.3 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.6 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.7 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.9 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.13 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.23 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.3 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.4 [c:\program files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.3 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.6 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.7 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.9 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.13 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.23 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.3 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.4 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.0 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.8 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.10 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.2 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.1 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.4 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.5 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.0 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.1 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.2 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.0 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.3 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.9 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.3 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.6 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.7 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.9 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.13 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.23 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.3 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.4 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.0 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.8 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.10 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.2 [c:\program files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.8 [c:\program files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.10 [c:\program files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.1 [c:\program files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.2 [c:\program files\dotnet\shared\Microsoft.WindowsDesktop.App]

JunTaoLuo commented 3 years ago

As far as we know, this is a scenario that has worked for us. @shirhatti can you follow up?

shirhatti commented 3 years ago

I've seen this when folks accidentally monitor the wrong process 😀

Can you ensure the pid you're monitoring actually matches the output of dotnet counters ps?

eliassal commented 3 years ago

Sorry, I forgot to update the thread, it was solved, thanks