Open DurgaPrasadReddyV opened 3 years ago
Can you use the API proposal template and propose an API?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
See our Issue Management Policies for more information.
Can you use the API proposal template and propose an API?
updated issue with api proposal template.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Background and Motivation
Currently IHealthCheckBuilder provides a "AddCheck" method to register a custom health check in my application.
services.AddHealthChecks().AddCheck<CustomHealthCheck>("CustomHealthCheck");
And inline is implementation for CheckHealthAsync method in my CustomHealthCheck class.
We can observe that I am able to return only one HealthCheckResult object from my CustomHealthCheck class. I am looking for an api from which I can return multiple health check results from a single custom health check class. Into this custom health check class I would like to add and remove health checks from an external application while the application is running so that there would be no need to modify code and redeploy the application.
Proposed API
services.AddHealthChecks().AddChecks<CustomHealthChecks>("CustomHealthChecks");
And inline is implementation for CheckHealthAsync method in my CustomHealthChecks class. The interface would be IHealthChecks instead of IHealthCheck which returns a list of HealthCheckResults.
Usage Examples
services.AddHealthChecks().AddChecks<CustomHealthChecks>("CustomHealthChecks");
With this registration in my ConfigureServices method I can add 0 to n healthchecks in my CustomHealthChecks class during runtime and return their status by populating the list.
Alternative Designs
Currently I am populating the IReadOnlyDictionary<string, object> Data of HealthCheckResult class to meet the requirement of different health checks status added dynamically during runtime.
Risks
No risk is involved because this is new api.