Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Add performance collector module for aspnet.core #470

Closed
cijothomas opened this issue Jun 14, 2017 · 26 comments
Closed

Add performance collector module for aspnet.core #470

cijothomas opened this issue Jun 14, 2017 · 26 comments
Assignees
Milestone

Comments

@cijothomas
Copy link
Contributor

At present, performance collector module exists only if run against full framework. (means there won't be any counters collected when running in linux/mac)

The proposal is to modify performance collector to run in pure .net core, collecting perf counters the usual way from windows environments, and implementing new way to collect counters from unix environments. The new way would be similar to how perf counters are collected from Azure Web Apps - instead of reading the special ENV variables exposed by Azure WebApps, we can linux specific commands like netstat etc.

@dnduffy
Copy link
Contributor

dnduffy commented Jun 16, 2017

This is kind of the same as #460.

@dnduffy
Copy link
Contributor

dnduffy commented Jun 16, 2017

Note that there is no support for performance counters even on Windows in .NET Core.

@AlexBulankou AlexBulankou modified the milestone: Future Jul 5, 2017
@JonasSamuelsson
Copy link

JonasSamuelsson commented Oct 30, 2017

Do you have an updated eta on this one, this really hinders us from migrating from aps.net to asp.net core as we loose a lot of insights in how our apis are behaving.
We are running on windows so for us getting this working there would be a great start.

And more generally, how is progress of this entire repo coming along, both beta1 & beta2 has passed their due dates...

@cijothomas
Copy link
Contributor Author

@JonasSamuelsson Application Insights does not collect perf counters on asp.net core, because .net core does not have a concept of Performance Counters yet. Once .net core provides this feature, application insights will surely support it. There are several discussions on dotnet core Github repo about perf counters support ..like
https://github.com/dotnet/corefx/issues/3906
dotnet/aspnetcore#1319

@cijothomas
Copy link
Contributor Author

@JonasSamuelsson Regarding releases of next version. Apologies for not updating the release dates, we (and other ApplicationInsights sdk which this depends on )faced certain infra issues that caused the delay.
Version 2.2.0-beta1 is undergoing final internal testing, and is going to be in nuget this week/next monday.
A lot of new features are added, as indicated here:
https://github.com/Microsoft/ApplicationInsights-aspnetcore/blob/develop/CHANGELOG.md

@cijothomas
Copy link
Contributor Author

https://www.nuget.org/packages/System.Diagnostics.PerformanceCounter/ Need to look at this to see if we can support perf counters in netstandard.

@cijothomas cijothomas modified the milestones: Future, 2.3.0 Feb 2, 2018
@johnjbateman
Copy link

I would greatly appreciate this. Running Linux containers and I cannot see perf counters because it is dotnet core.

@aligneddev
Copy link

Looks like it will be released in 2.4.0!

@cijothomas
Copy link
Contributor Author

@aligneddev https://github.com/Microsoft/ApplicationInsights-aspnetcore/blob/develop/CHANGELOG.md#version-240-beta1
What's part of 2.4.0 release is support for perf counters when application is running on Azure Web Apps. If you are on Azure Web Apps, you will be able to see counters, but not in linux yet.

@cijothomas cijothomas modified the milestones: 2.4.0, 2.5.0 Aug 3, 2018
@cijothomas
Copy link
Contributor Author

https://www.nuget.org/packages/System.Diagnostics.PerformanceCounter/4.5.0 - Now that System.Diagnostics.PerformanceCounter stable is out, we may want to conside modifying ApplicationInsights to use this, and start supporting counters for asp.net core apps.

@cijothomas cijothomas self-assigned this Aug 6, 2018
@cijothomas cijothomas modified the milestones: 2.5.0, 2.6.0 Oct 3, 2018
@cijothomas cijothomas modified the milestones: 2.6.0, 2.7.0 Jan 25, 2019
@nhart12
Copy link

nhart12 commented Feb 7, 2019

I got this working in an ASP.net core 2 project as a quick workaround by forking ApplicationInsights-dotnet-server and adding a netstandard 2.0 target & having a conditional reference to the above nuget (https://www.nuget.org/packages/System.Diagnostics.PerformanceCounter/4.5.0) to the Perf project. The commit is here https://github.com/nhart12/ApplicationInsights-dotnet-server/commit/123b97aa78185eca24b24b7b8c841f7581acf72d

@rh78
Copy link

rh78 commented Feb 11, 2019

@nhart12 will this then also work for Linux or is all of this pure Windows again?

@cijothomas
Copy link
Contributor Author

@rh78 The above is windows only.

@nhart12 Would you like to contribute this to the official branch by submitting a PR ? We can help with any guidance required here.

@rh78
Copy link

rh78 commented Feb 11, 2019

@cijothomas OK is there an issue that is being tracked for Linux?

@cijothomas
Copy link
Contributor Author

@rh78 This issue is for both linux/windows.
Sorry what i meant in above comment was that the solution by @nhart12 using https://www.nuget.org/packages/System.Diagnostics.PerformanceCounter/4.5.0 is a windows only one.

@rh78
Copy link

rh78 commented Feb 11, 2019

@cijothomas OK cool thank you - is there an estimate on when we can expect tracking support for CPU/memory/etc. on Linux?

@cijothomas
Copy link
Contributor Author

The team has work planned to collect process level counters for all platforms (linux+windows) by June/July 2019 time frame. We are working with the .net core team to align with their future plans for counters in general. Will share more info as we start working on this and this is only an estimated date now.

@rh78
Copy link

rh78 commented Feb 11, 2019

It's a tragedy. It renders AI useless for production use as a monitoring tool, because stats are only meaningful when being accompanied with low level stats as CPU and memory consumption. I am looking forward for a change - all the best!

@nhart12
Copy link

nhart12 commented Feb 12, 2019

@rh78 The above is windows only.

@nhart12 Would you like to contribute this to the official branch by submitting a PR ? We can help with any guidance required here.

I created PR over here. I'm sure there is more to be done to target netstandard 2.0 on some of the other projects, but this got it working for me.
microsoft/ApplicationInsights-dotnet-server#1148

@cijothomas
Copy link
Contributor Author

@nhart12 's PR is merged and will be released as beta3

@twurm
Copy link

twurm commented Apr 16, 2019

@cijothomas we've upgraded one of our web applications to beta3, we see CPU and RAM information for Kestrel hosted applications, but not when they are deployed to IIS. Is this expected? I was hoping we would get that information no matter how the web server.

@cijothomas
Copy link
Contributor Author

@twurm No its no expected. Perf Counters should work irrespective of Web Server. Can you create a new issue to track this better? Please include as much details as you can share.

@nhart12
Copy link

nhart12 commented Apr 16, 2019

@twurm make sure the user the app pool is running as has access to perf counters

@twurm
Copy link

twurm commented Apr 19, 2019

@nhart12 that's probably the problem, we are running the app pools as: ApplicationPoolIdentity. I'll take a look on Monday.

@cijothomas
Copy link
Contributor Author

thanks @nhart12.
@twurm The #1 reason i've found related to perf counter not working is permission issue. I am wondering why SDK didnt sent a error trace to your ikey, stating "i am having trouble reading perf counter". Please respond back when you get time if permission issue fixed your case.

@cijothomas
Copy link
Contributor Author

This is addressed for Windows in 2.7. Closing this.
#875 This issue tracks the X-Platform performance counters work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants