We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20d925f commit dbb07bfCopy full SHA for dbb07bf
1 file changed
code/function/fastapp/main.py
@@ -6,7 +6,15 @@
6
from fastapp.utils import setup_opentelemetry
7
8
9
-def get_app(lifespan) -> FastAPI:
+@asynccontextmanager
10
+async def lifespan(app: FastAPI) -> None:
11
+ """Gracefully start the application before the server reports readiness."""
12
+ setup_opentelemetry(app=app)
13
+ yield
14
+ pass
15
+
16
17
+def get_app() -> FastAPI:
18
"""Setup the Fast API server.
19
20
RETURNS (FastAPI): The FastAPI object to start the server.
@@ -23,12 +31,4 @@ def get_app(lifespan) -> FastAPI:
23
31
return app
24
32
25
33
26
-@asynccontextmanager
27
-async def lifespan(app: FastAPI) -> None:
28
- """Gracefully start the application before the server reports readiness."""
29
- setup_opentelemetry(app=app)
30
- yield
- pass
-
34
-app = get_app(lifespan=lifespan)
+app = get_app()
0 commit comments