Skip to content

FastStream health check pings only the first broker of a multi-broker app #293

Open

Description

@lesnik512

FastStreamHealthChecksInstrument._define_health_status pings config.application.broker and nothing else (lite_bootstrap/bootstrappers/faststream_bootstrapper.py:110). In FastStream that property returns self.brokers[0]. An app that holds more than one broker, for example through add_broker in FastStream 0.7, reports healthy while every broker after the first is down.

Services that need the other brokers checked set health_checks_enabled=False and mount their own route, which drops the OpenTelemetry span and response format the built-in check provides.

Proposal

Ping every broker in config.application.brokers and report healthy only when all of them answer. brokers exists from FastStream 0.6, so this works across the current faststream>=0.6 floor. Running the pings concurrently keeps the total wait within faststream_health_check_broker_timeout.

Acceptance

  • An app with two brokers where the second fails its ping gets a 500 from the health route.
  • An app with one broker behaves as it does now.

Activity

  1. lesnik512 commented on Oct 20, 2026

    @lesnik512
    MemberAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: The FastStream health check must ping every broker the app holds, not only the first.

    Verified: I built an AsgiFastStream with two RedisBrokers (the second added with add_broker), patched the first broker's ping to return True and the second's to return False, and called the health route. It returned 200, and the second broker's ping was never called.

    Current behavior:
    The FastStream health check pings only application.broker, which FastStream defines as brokers[0]. An app with several brokers reports healthy while any broker after the first is down. An app with no broker reports unhealthy.

    Desired behavior:
    The health check pings every broker in application.brokers and reports healthy only when all of them answer True. The pings run concurrently, each with faststream_health_check_broker_timeout, so the route's total wait stays within one timeout rather than one per broker. An app with no brokers still reports unhealthy. The response bodies and status codes for the healthy and unhealthy cases stay as they are.

    Key interfaces:

    • FastStreamHealthChecksInstrument: the method that decides health status reads application.brokers instead of application.broker.
    • FastStreamConfig.faststream_health_check_broker_timeout: unchanged, applied to each ping.
    • application.brokers exists from FastStream 0.6, so the faststream>=0.6 floor stays.

    Acceptance criteria:

    • With two brokers where the second's ping returns False, the health route returns 500.
    • With two brokers that both answer True, the health route returns 200, and each broker's ping is called once with the configured timeout.
    • With one broker, the existing health-check tests pass unchanged.
    • With no broker, the route still reports unhealthy.

    Out of scope:

  2. added
    bugSomething isn't working
    ready-for-agentFully specified, ready for an AFK agent
    and removed
    needs-triageMaintainer needs to evaluate this issue
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions