File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
6
6
def get_app () -> FastAPI :
7
+ """Setup the Fast API server.
8
+
9
+ RETURNS (FastAPI): The FastAPI object to start the server.
10
+ """
7
11
app = FastAPI (
8
12
title = settings .PROJECT_NAME ,
9
13
version = settings .APP_VERSION ,
@@ -19,9 +23,11 @@ def get_app() -> FastAPI:
19
23
20
24
@app .on_event ("startup" )
21
25
async def startup_event ():
26
+ """Gracefully start the application before the server reports readiness."""
22
27
pass
23
28
24
29
25
30
@app .on_event ("shutdown" )
26
31
async def shutdown_event ():
32
+ """Gracefully close connections before shutdown of the server."""
27
33
pass
Original file line number Diff line number Diff line change 2
2
from logging import Logger
3
3
4
4
from fastapp .core .config import settings
5
+ from opencensus .extension .azure .functions import OpenCensusExtension
6
+ from opencensus .trace import config_integration
7
+
8
+ config_integration .trace_integrations (["requests" ])
9
+ OpenCensusExtension .configure ()
5
10
6
11
7
12
def setup_logging (module ) -> Logger :
Original file line number Diff line number Diff line change 5
5
azure-functions ~= 1.14.0
6
6
fastapi ~= 0.96.1
7
7
aiohttp ~= 3.8.4
8
+ opencensus-extension-azure-functions ~= 1.0.0
9
+ opencensus-ext-requests ~= 0.8.0
You can’t perform that action at this time.
0 commit comments