-
Notifications
You must be signed in to change notification settings - Fork 3
Allow auto registering of health checks in full framework #2
Comments
… health checks in full framework
This is closed but in App.Metrics.AspNetCore.Health.Endpoints version 2.0.0-preview1 the DependencyInjection and RegisterFromAssembly doesn't seem to work at all. |
Hmm, OK, my unit test for this works but it's scanning the same assembly as the test itself :) Any chance you'd be able to look into this one? The code to look at would be be |
I have found what was wrong, in https://www.app-metrics.io/web-monitoring/aspnet-core/health/ the documentation is incorrect/outdated. It seems that RegisterFromAssembly doesn't work if you don't call BuildAndAddTo.
For now I have the following workaround (this is for someone who stumbles upon this looking for workaround):
I would expect dependency injection with AppMetrics to work similar to what I have done - resolving my healthchecks with their dependencies each time healthcheck endpoint is called. Unfortunately it is not the case right now. |
Thanks for the details and looking into this @relair
Ah that could be the case, I thought I changed this to check for class which inherit health check rather than ends with "HealthCheck". Will look into this one for the next release
Yep, was tricky to do otherwise. Will have to review again for the details as memory isn't serving me. It could be less verbose than your work around to inject a |
… checks from assembly
Documentation updated |
Resolved |
Dependency context does't seem to work when usign to find all health checks in referenced assemblies.
The text was updated successfully, but these errors were encountered: