Skip to content
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

Retire IResourceMonitor set of API in favor of observable instruments #5414

Open
evgenyfedorov2 opened this issue Sep 10, 2024 · 7 comments
Open
Assignees

Comments

@evgenyfedorov2
Copy link
Contributor

Currently, ResourceMonitoring can be consumed in two ways:

Both ways provide the same resource monitoring data, so essentially we have duplicated functionality. We can simplify it all by deprecating the IResourceMonitor API and recommend the observable instruments as the only way forward. Namely, we can deprecate following classes (or structs):
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/SystemResources.cs
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Snapshot.cs
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceUtilization.cs
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ISnapshotProvider.cs
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitorBuilder.cs
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitor.cs

Pros:

  • Simplified API
  • Improved performance, avoiding wasting resources for the BackgroundService

Cons:

  • Users of the IResourceMonitor will be blocked in case they don't use .NET Metrics
@evgenyfedorov2
Copy link
Contributor Author

@RussKie @joperezr @geeknoid @andrey-noskov - please take a look when you have time

@geeknoid
Copy link
Member

Regarding your "con", given that we wouldn't be deleting the API and just marking it obsolete, then nobody would be 'blocked', right?

@andrey-noskov
Copy link

yes, please!
this probably should include ResourceMonitorService, CircularBuffer, Calculator and many other internal utilities that power our IResourceMonitor implementation.

@evgenyfedorov2
Copy link
Contributor Author

Regarding your "con", given that we wouldn't be deleting the API and just marking it obsolete, then nobody would be 'blocked', right?

Yes.

Another question - I assume we will be able to delete any Obsolete API when .NET 8 support ends, e.g. in 2026?

@geeknoid
Copy link
Member

@joperezr Are obsoleted APIs ever removed from the code base?

@joperezr
Copy link
Member

Yes, they can be. Typically that is done in the subsequent LTS version after being marked as obsoleted (in an LTS version too). This policy is documented here: https://learn.microsoft.com/en-us/dotnet/core/compatibility/api-removal

@RussKie
Copy link
Member

RussKie commented Sep 11, 2024

@evgenyfedorov2: sounds good to me. We can mark these API (and anything else related) as obsolete in the .NET 9 release (i.e., the dev branch). We'll also need to create migration guides.

There isn't much time before we switch to .NET 9, so we should do this before then.

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

No branches or pull requests

5 participants