Pluggable SiloPerformanceMetrics
The current implementation of SiloPerformanceMetrics is a bit thin. Specifically, IsOverloaded can only account for CPU. I've been looking at the best way to allow dependency injection here - and am looking for other opinions.
My first thought was to allow ISiloPerformanceMetrics to be injected in its entirety. The first glaring problem with this is that SiloStatisticsManager relies on members of SiloPerformanceMetrics which are not in the interface ISiloPerformanceMetrics.
Perhaps adding an IOverloadedProvider (pluggable from IServiceProvider) would be sufficient?
public interface IOverloadedProvider{
bool IsOverloaded(ISiloPerformanceMetrics metrics); // or ICorePerformanceMetrics
}
One of my use cases for this is to be able to disable a Silo without killing currently executing grains (for maintentance, or whatever).
- What sort of ideas do you have for making functionality in
SiloPerformanceMetricspluggable? - If I was able to inject logic to disable a Silo (by returning true from
IsOverloaded), are there any undesirable effects you are aware of?
About question 1, We are currently in the direction of making internal system types, such as ISiloPerformanceMetrics, injectable through Dependency Injection. We made our first attempt with #2192 , which is making IGrainFactoryinjectable.
We discussed about making internal types replaceable/pluggable, but not too sure about the needs from the community, until I saw your issue.
If you want to replace the full implementation of SiloPerformanceMetrics including internal methods, which require us adding new members to ISiloPerformanceMetrics interface, this is a bigger problem to discuss.
But if you just want to make IsOverloadedmethod thicker, you can inject your own implementation of ISiloPerformanceMetrics , which decorating on top of the original SiloPerformanceMetrics, and you add more stuff you want into IsOverloadedmethod.
Or if you think IsOverloadedis too thin in SiloPerformanceMetrics, submit a PR to us to change it, show which way you want to make it thicker. I agree with you here, only account for CPU is too thin for IsOverloaded . Maybe you want to add memory? Not sure what you want to add here.
We removed silo and client metrics reporting mechanism in 2.0 in favor of the telemetry system.