Repository navigation
fix: ping every broker in the FastStream health check - #296
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #293.
The FastStream health check pinged only
application.broker, which FastStream defines asbrokers[0]. An app with a second broker, added withadd_brokeror passed toAsgiFastStreamdirectly, reported healthy while that broker was down.The check now pings every broker in
application.brokersand reports healthy only when all of them returnTrue. The pings run concurrently throughasyncio.gather, each withfaststream_health_check_broker_timeout, so the route still waits at most one timeout, not one per broker. With a single broker the behavior is unchanged. With no broker the route still reports unhealthy. Response bodies and status codes are unchanged.brokersexists from FastStream 0.6, so thefaststream>=0.6floor stays.Tests, written first and failing before the fix:
False: 500pingcalled once with the configured timeoutOut of scope: the OpenTelemetry, Prometheus and logging instruments that also see only the first broker (#295).