Skip to content

Commit 94aacd6

Browse files
committed
Add tracing to faststream asgi health-check
1 parent 958f4db commit 94aacd6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

microbootstrap/bootstrappers/faststream.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from faststream.asgi import AsgiFastStream, AsgiResponse
99
from faststream.asgi import get as handle_get
1010
from faststream.specification import AsyncAPI
11+
from opentelemetry import trace
1112

1213
from microbootstrap.bootstrappers.base import ApplicationBootstrapper
1314
from microbootstrap.config.faststream import FastStreamConfig
@@ -23,6 +24,9 @@
2324
from microbootstrap.settings import FastStreamSettings
2425

2526

27+
tracer: typing.Final = trace.get_tracer(__name__)
28+
29+
2630
class KwargsAsgiFastStream(AsgiFastStream):
2731
def __init__(self, **kwargs: typing.Any) -> None: # noqa: ANN401
2832
# `broker` argument is positional-only
@@ -107,6 +111,7 @@ def get_config_type(cls) -> type[FastStreamPrometheusConfig]:
107111
class FastStreamHealthChecksInstrument(HealthChecksInstrument):
108112
def bootstrap(self) -> None: ...
109113
def bootstrap_before(self) -> dict[str, typing.Any]:
114+
@tracer.start_as_current_span(f"GET {self.instrument_config.health_checks_path}")
110115
@handle_get
111116
async def check_health(scope: typing.Any) -> AsgiResponse: # noqa: ANN401, ARG001
112117
return (

0 commit comments

Comments
 (0)