Added prometheus client

Added scheduler for compute current spool metrics and info
This commit is contained in:
Dmitry Belousov
2024-04-09 15:25:09 +03:00
parent 29f54358d6
commit 28b2bfec50
6 changed files with 776 additions and 768 deletions

View File

@@ -16,6 +16,8 @@ from spoolman.api.v1.router import app as v1_app
from spoolman.client import SinglePageApplication
from spoolman.database import database
from spoolman.prometheus.metrics import metrics_app
# Define a console logger
console_handler = logging.StreamHandler()
console_handler.setFormatter(logging.Formatter("%(name)-26s %(levelname)-8s %(message)s"))
@@ -37,9 +39,9 @@ app = FastAPI(
)
app.add_middleware(GZipMiddleware)
app.mount("/api/v1", v1_app)
app.mount("/metrics", metrics_app)
app.mount("/", app=SinglePageApplication(directory="client/dist"), name="client")
# Allow all origins if in debug mode
if env.is_debug_mode():
logger.warning("Running in debug mode, allowing all origins.")