Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions microbootstrap/bootstrappers/faststream.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from faststream.asgi import AsgiFastStream, AsgiResponse
from faststream.asgi import get as handle_get
from faststream.specification import AsyncAPI
from opentelemetry import trace

from microbootstrap.bootstrappers.base import ApplicationBootstrapper
from microbootstrap.config.faststream import FastStreamConfig
Expand All @@ -23,6 +24,9 @@
from microbootstrap.settings import FastStreamSettings


tracer: typing.Final = trace.get_tracer(__name__)


class KwargsAsgiFastStream(AsgiFastStream):
def __init__(self, **kwargs: typing.Any) -> None: # noqa: ANN401
# `broker` argument is positional-only
Expand Down Expand Up @@ -107,6 +111,7 @@ def get_config_type(cls) -> type[FastStreamPrometheusConfig]:
class FastStreamHealthChecksInstrument(HealthChecksInstrument):
def bootstrap(self) -> None: ...
def bootstrap_before(self) -> dict[str, typing.Any]:
@tracer.start_as_current_span(f"GET {self.instrument_config.health_checks_path}")
@handle_get
async def check_health(scope: typing.Any) -> AsgiResponse: # noqa: ANN401, ARG001
return (
Expand Down