Skip to content

Commit

Permalink
monitoring progress
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Nov 4, 2024
1 parent 142953a commit ff0f132
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions services/director/src/simcore_service_director/monitoring.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import prometheus_client
from aiohttp import web
from fastapi import FastAPI
from prometheus_client import CONTENT_TYPE_LATEST
from prometheus_client.registry import CollectorRegistry


from servicelib.monitor_services import ( # pylint: disable=no-name-in-module
from servicelib.monitor_services import (
add_instrumentation as add_services_instrumentation,
)

from . import config
from simcore_service_director.core.settings import ApplicationSettings

kCOLLECTOR_REGISTRY = f"{__name__}.collector_registry"

Expand All @@ -21,8 +18,9 @@ async def metrics_handler(request: web.Request):
return resp


def setup_app_monitoring(app: web.Application, app_name: str) -> None:
if not config.MONITORING_ENABLED:
def setup_app_monitoring(app: FastAPI, app_name: str) -> None:
app_settings: ApplicationSettings = app.state.settings
if not app_settings.DIRECTOR_MONITORING_ENABLED:
return
# app-scope registry
app[kCOLLECTOR_REGISTRY] = reg = CollectorRegistry(auto_describe=True)
Expand Down

0 comments on commit ff0f132

Please sign in to comment.