add convex health metrics route
Build and Push Docker Container / build-and-push (push) Successful in 2m4s

This commit is contained in:
2026-04-01 21:32:28 +02:00
parent d9b7c88ccf
commit 4773338ccc
4 changed files with 35 additions and 1 deletions
+1
View File
@@ -68,6 +68,7 @@ LIMITER = Limiter(
)
convex_runtime = ConvexWorkerPool(os.getenv("CONVEX_URL"))
app.convex_runtime = convex_runtime
@app.before_serving
async def init_convex():
+3
View File
@@ -4,3 +4,6 @@ from .auth.login import auth_login_bp
from .side.main import side_main_bp
from .side.upload import upload_bp
# Health
from .api.health import health_bp
+27
View File
@@ -0,0 +1,27 @@
from my_modules.decoratory.header import format_response, feature_flag_required
from my_modules.app.setup import LIMITER
from my_modules.app.logger import logger
from quart import Blueprint, current_app
health_bp = Blueprint("health", __name__)
@health_bp.route("/convex", methods=["GET"])
@LIMITER.limit("30 per minute")
@feature_flag_required("convex_health", fallback=False, status_code=404)
@format_response
async def get_convex_health_for_api():
runtime = getattr(current_app, "convex_runtime", None)
if runtime is None:
return {
"status": "unavailable",
"description": "Convex runtime is not attached to app",
}, 503
is_alive = await runtime.is_alive()
metrics = runtime.get_metrics()
return {
"alive": is_alive,
"metrics": metrics,
}, 200 if is_alive else 503
+4 -1
View File
@@ -10,7 +10,8 @@ import routes.handeling.errorsAndBots
from routes import (
basic_bp, auth_login_bp,
side_main_bp,
upload_bp
upload_bp,
health_bp
)
# Views for Requests adding the uris
@@ -20,5 +21,7 @@ app.register_blueprint(auth_login_bp)
app.register_blueprint(side_main_bp)
app.register_blueprint(upload_bp)
app.register_blueprint(health_bp, url_prefix='/health')
if __name__ == '__main__':
app.run(debug=WEB_DEBUG, port=5502)