-
-
Notifications
You must be signed in to change notification settings - Fork 2
Fix a bug that prevented health checks from becoming degraded #858
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #858 +/- ##
==========================================
- Coverage 66.42% 66.42% -0.01%
==========================================
Files 382 382
Lines 20785 20784 -1
Branches 2717 2717
==========================================
- Hits 13807 13805 -2
- Misses 6008 6009 +1
Partials 970 970 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Enkidu93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't believe we missed this! I was sure this was working in the past for at least the s3 health check 🤔. I'm noticing, Peter, that the S3HealthCheck is added as a singleton in Machine.Shared.IServiceCollectionExtensions.AddMachine() whereas the other health checks are not and have been moved to SIL.ServiceToolkit.Configuration.IHealthChecksBuilderExtensions. Is adding the S3HealthCheck as a singleton not 'taking' for some reason? If adding the health checks as singletons works, is that a better option? Or do you think using the memory cache is more appropriate? Regardless, I think it would make sense for you to move the health-check adding logic to SIL.ServiceToolkit.Configuration.IHealthChecksBuilderExtensions.
@Enkidu93 reviewed 7 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ddaspit).
ddaspit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought. The health check is a singleton. That would make me think that it can hold state. Maybe there is something that we don't understand about how the health check works.
@ddaspit reviewed 7 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @pmachapman).
b08e2ed to
8e61dc2
Compare
pmachapman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OutboxHealthCheck service consumes the IRepository<OutboxMessage> service which is scoped. This means that OutboxHealthCheck cannot be a singleton.
I updated the ClearMLHealthCheck and S3HealthCheck services to use the same IMemoryCache implementation as OutboxHealthCheck mostly for consistency reasons, and to prevent this bug from unintentionally being introduced to those services in future, if they for some reason stop being singleton (i.e. because they have to consume a scoped service in a future update/modification). If you think that's overkill, I can just write a comment in those two health checks to that effect?
@pmachapman made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @pmachapman).
Fixes #836
This change is