Skip to content

Commit e4b273b

Browse files
committed
adds all monitoring and profiling
1 parent 4a70033 commit e4b273b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

services/web/server/src/simcore_service_webserver/application.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,23 @@ def create_application() -> web.Application:
194194

195195
def create_application_auth() -> web.Application:
196196
app = create_safe_application()
197-
settings = setup_settings(app, app_name="simcore_service_wb_auth")
198197

198+
settings = setup_settings(app, app_name="simcore_service_wb_auth")
199199
assert settings.WEBSERVER_APP_FACTORY_NAME == "WEBSERVER_AUTHZ_APP_FACTORY" # nosec
200200
assert settings.APP_NAME == "simcore_service_wb_auth" # nosec
201201

202+
# Monitoring and diagnostics
202203
setup_app_tracing(
203-
# NOTE: uses settings.APP_NAME
204204
# WARNING: must be UPPERMOST middleware
205+
# NOTE: uses settings.APP_NAME
205206
app
206207
)
208+
setup_diagnostics(app)
209+
setup_profiling_middleware(app)
207210

211+
# Core modules
208212
setup_rest(app)
209213
setup_db(app)
210-
211214
setup_login_auth(app)
212215

213216
# NOTE: *last* events

services/web/server/src/simcore_service_webserver/diagnostics/plugin.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def _on_healthcheck_async_adapter(app: web.Application) -> None:
3333
settings_name="WEBSERVER_DIAGNOSTICS",
3434
logger=_logger,
3535
)
36-
def setup_diagnostics(app: web.Application) -> None:
36+
def setup_diagnostics(app: web.Application):
3737
setup_rest(app)
3838

3939
settings: DiagnosticsSettings = get_plugin_settings(app)
@@ -58,8 +58,12 @@ def setup_diagnostics(app: web.Application) -> None:
5858
app[HEALTH_PLUGIN_START_TIME] = time.time()
5959

6060

61-
def setup_profiling_middleware(
62-
app: web.Application,
63-
) -> None:
64-
if get_application_settings(app).WEBSERVER_PROFILING:
65-
app.middlewares.append(profiling_middleware)
61+
@app_module_setup(
62+
__name__,
63+
ModuleCategory.ADDON,
64+
settings_name="WEBSERVER_PROFILING",
65+
logger=_logger,
66+
)
67+
def setup_profiling_middleware(app: web.Application):
68+
assert get_application_settings(app).WEBSERVER_PROFILING # nosec
69+
app.middlewares.append(profiling_middleware)

0 commit comments

Comments
 (0)