File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/service-library/src/servicelib/fastapi Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,12 @@ def initialize_prometheus_instrumentation(app: FastAPI) -> None:
2222 app .state .prometheus_instrumentator .instrument (app )
2323
2424
25- def _startup (app : FastAPI ) -> None :
25+ async def _startup (app : FastAPI ) -> None :
2626 assert isinstance (app .state .prometheus_instrumentator , Instrumentator ) # nosec
2727 app .state .prometheus_instrumentator .expose (app , include_in_schema = False )
2828
2929
30- def _shutdown (app : FastAPI ) -> None :
30+ async def _shutdown (app : FastAPI ) -> None :
3131 assert isinstance (app .state .prometheus_registry , CollectorRegistry ) # nosec
3232 registry = app .state .prometheus_registry
3333 for collector in list (registry ._collector_to_names .keys ()): # noqa: SLF001
@@ -51,6 +51,6 @@ def setup_prometheus_instrumentation(app: FastAPI) -> Instrumentator:
5151async def lifespan_prometheus_instrumentation (app : FastAPI ) -> AsyncIterator [State ]:
5252 # NOTE: requires ``initialize_prometheus_instrumentation`` to be called before the
5353 # lifespan of the applicaiton runs, usually rigth after the ``FastAPI`` instance is created
54- _startup (app )
54+ await _startup (app )
5555 yield {}
56- _shutdown (app )
56+ await _shutdown (app )
You can’t perform that action at this time.
0 commit comments