feat(logging): add NanoShare wide event instrumentation
Build and Push Docker Container / build-and-push (push) Failing after 51s
Build and Push Docker Container / build-and-push (push) Failing after 51s
- Register quart_common wide-event logging during app setup so every HTTP request emits one canonical structured event. - Replace the inline security middleware with reusable quart_common security middleware wiring and move skip path configuration into app constants. - Add NanoShare-specific wide-event context for health checks, auth/error handlers, file list/edit/delete/serve flows and upload outcomes. - Rename runtime logging/project metadata from simple-picoshare to nanoshare where it is emitted in service context. - Update my_helpers and quart_common submodules for Convex/wide-event integration and reusable security middleware support. - Add NanoShare middleware tests covering safe user context, client IP enrichment, missing Convex handling and Convex security lookup failures.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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_common.web.wide_event import add_wide_event_context
|
||||
|
||||
from quart import Blueprint, current_app
|
||||
|
||||
@@ -11,8 +12,10 @@ health_bp = Blueprint("health", __name__)
|
||||
@feature_flag_required("convex_health", fallback=False, status_code=404)
|
||||
@format_response
|
||||
async def get_convex_health_for_api():
|
||||
add_wide_event_context(health={"check": "convex"})
|
||||
runtime = getattr(current_app, "convex_runtime", None)
|
||||
if runtime is None:
|
||||
add_wide_event_context(health={"status": "unavailable", "reason": "runtime_missing"})
|
||||
return {
|
||||
"status": "unavailable",
|
||||
"description": "Convex runtime is not attached to app",
|
||||
@@ -20,6 +23,7 @@ async def get_convex_health_for_api():
|
||||
|
||||
is_alive = await runtime.is_alive()
|
||||
metrics = runtime.get_metrics()
|
||||
add_wide_event_context(health={"status": "ok" if is_alive else "unhealthy"})
|
||||
|
||||
return {
|
||||
"alive": is_alive,
|
||||
|
||||
Reference in New Issue
Block a user