-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing Windows Specifc performance counter dependency with cross platfrom EventCounters #1924
Comments
Sounds good to me |
I may be missing it here, but I don't think this counter exists in the EventCounters space. There's a subtle but important difference: we're using If there's a way to get global in a fewer dependency way I am also all for it, just not aware of that path at the moment :) |
@NickCraver I saw below code in RavenDB , to calculate CPU usage for Windows/Linux/Mac |
@madhub it's possible, but that's baking in multiple system calls cross-platform into the library which I think makes things worse for cases like #1442 that we want to solve with |
Given this approach isn't viable in the library but the over platform TFMs are on the table, I'm going to tidy up this issue and we'll remain open to adding those TFMs if needed. |
Heads up: we revisited this based on issue data and me crawling old issues again to see effectiveness. Not fixed in terms of how to fetch, just removed as not-worth-it tradeoff given even more downsides with vulnerabilities downstream. Version 2.6.80+ will no longer reference System.Diagnostics.PerformanceCounter. |
Currently Redis client implementation depends PerformanceCounter class to get CPU time, which brings additional Windows specific nuget package
Microsoft.Win32.Registry,System.Configuration.ConfigurationManager
each of these inturn brings additional packages creating dependency hell , instead of this it is better to use cross platform EventCounters .As EventCounters is available in .NET 3.1 on wards , we can use it for .NET Core 3.1 target & older targets still use the PerformanceCounter as is.
Sample implementation of how to get cpu-usage is from Event Counter
Reference Resource
The text was updated successfully, but these errors were encountered: