From 2fde5ffc87266c576c3bb79aeb2e7d40cd2fe422 Mon Sep 17 00:00:00 2001 From: Abel Luck Date: Fri, 6 Mar 2026 11:48:21 +0100 Subject: [PATCH] Expose matrix-ops-bot /metrics endpoint --- nix/tests/matrix-ops-bot.nix | 1 + ops_bot/main.py | 1 + 2 files changed, 2 insertions(+) diff --git a/nix/tests/matrix-ops-bot.nix b/nix/tests/matrix-ops-bot.nix index 11c0bac..36e702b 100644 --- a/nix/tests/matrix-ops-bot.nix +++ b/nix/tests/matrix-ops-bot.nix @@ -47,5 +47,6 @@ self: { machine.succeed("test -f /run/credentials/matrix-ops-bot.service/bot.env") machine.succeed("curl -sf http://127.0.0.1:1111/ | grep -F '\"message\":\"Hello World\"'") + machine.succeed("curl -sf http://127.0.0.1:1111/metrics | grep -F '# HELP'") ''; } diff --git a/ops_bot/main.py b/ops_bot/main.py index 44316c4..fbbaaf4 100644 --- a/ops_bot/main.py +++ b/ops_bot/main.py @@ -48,6 +48,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]: # start_http_server(9000) app = FastAPI(lifespan=lifespan) instrumentator = Instrumentator().instrument(app) +instrumentator.expose(app, endpoint="/metrics", include_in_schema=False) bearer_security = HTTPBearer(auto_error=False) basic_security = HTTPBasic(auto_error=False)