File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
packages/service-library/src/servicelib/fastapi
director/src/simcore_service_director/core
storage/src/simcore_service_storage/core Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 22
33import httpx
44from fastapi import FastAPI
5+ from servicelib .fastapi .tracing import setup_httpx_client_tracing
6+ from settings_library .tracing import TracingSettings
57
68
79def setup_client_session (
810 app : FastAPI ,
911 * ,
1012 default_timeout : datetime .timedelta = datetime .timedelta (seconds = 20 ),
11- max_keepalive_connections : int = 20
13+ max_keepalive_connections : int = 20 ,
14+ tracing_settings : TracingSettings | None ,
1215) -> None :
1316 async def on_startup () -> None :
1417 session = httpx .AsyncClient (
1518 transport = httpx .AsyncHTTPTransport (http2 = True ),
1619 limits = httpx .Limits (max_keepalive_connections = max_keepalive_connections ),
1720 timeout = default_timeout .total_seconds (),
1821 )
22+ if tracing_settings :
23+ setup_httpx_client_tracing (session )
1924 app .state .aiohttp_client_session = session
2025
2126 async def on_shutdown () -> None :
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ def create_app(settings: ApplicationSettings) -> FastAPI:
5050 app ,
5151 max_keepalive_connections = settings .DIRECTOR_REGISTRY_CLIENT_MAX_KEEPALIVE_CONNECTIONS ,
5252 default_timeout = settings .DIRECTOR_REGISTRY_CLIENT_TIMEOUT ,
53+ tracing_settings = settings .DIRECTOR_TRACING ,
5354 )
5455 setup_registry (app )
5556
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def create_app(settings: ApplicationSettings) -> FastAPI: # noqa: C901
6969
7070 setup_db (app )
7171 setup_s3 (app )
72- setup_client_session (app )
72+ setup_client_session (app , tracing_settings = settings . STORAGE_TRACING )
7373
7474 if settings .STORAGE_CELERY and not settings .STORAGE_WORKER_MODE :
7575 setup_rabbitmq (app )
You can’t perform that action at this time.
0 commit comments