-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Provide a way to run HealthIndicators concurrently #17617
Conversation
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.
Thanks a lot @nosan, that's very interesting.
I think we need to look at what we have on the reactive side of things and harmonize or update the PR in such a way the config is handled consistently. I've added a few suggestions
/** | ||
* Whether health indicators should be called concurrently. | ||
*/ | ||
private boolean enabled; |
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.
This is strictly related to the imperative approach as the reactive approach already benefits from that feature transparently. Given that indicators are already invoked in parallel I wonder if we should offer an option at all.
/** | ||
* Timeout to wait for the result from health indicators. | ||
*/ | ||
private Duration timeout; |
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 reactive approach has a strategy where both a timeout and a fallback can be provided. I think we should harmonize that here too.
* @author Dmytro Nosan | ||
* @since 2.2.0 | ||
*/ | ||
public class CompositeConcurrentHealthIndicator implements HealthIndicator { |
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 wouldn't create a separate class for this. Perhaps there is a way to extract the behavior in a Function
or something like that and just configure it externally when required?
Either way, this feature should be backed back in CompositeHealthIndicator
. We currently have a PRs on supporting health groups that relies on a single composite implementation.
Thank you very much @snicoll PR has been updated. I believe it is what you are expecting. |
From another point of view, maybe it makes sense to introduce
Update |
@snicoll
Please let me know what you think. |
to collect healths from the all indicators.
@nosan there was a major refactoring of the health support this week. Would you be interested to revisit your original proposal against |
@snicoll |
@snicoll |
No need to apologize @nosan and thank you for the feedback. |
see gh-2652
Please let me know if I need something to document.