Fix user delete flow 6

This commit is contained in:
Urtzi Alfaro
2025-08-02 21:56:25 +02:00
parent 63151c9bd4
commit fdacbee52f
3 changed files with 25 additions and 24 deletions

View File

@@ -66,20 +66,26 @@ async def startup_event():
"""Application startup"""
logger.info("Starting API Gateway")
# Start metrics server
metrics_collector.register_counter(
"gateway_auth_requests_total",
"Total authentication requests through gateway"
"Total authentication requests"
)
metrics_collector.register_counter(
"gateway_auth_responses_total",
"Total authentication responses through gateway"
"Total authentication responses"
)
metrics_collector.register_histogram(
"gateway_request_duration_seconds",
"Gateway request duration"
metrics_collector.register_counter(
"gateway_auth_errors_total",
"Total authentication errors"
)
metrics_collector.register_histogram(
"gateway_request_duration_seconds",
"Request duration in seconds"
)
logger.info("Metrics registered successfully")
metrics_collector.start_metrics_server(8080)

View File

@@ -203,9 +203,12 @@ class AuthMiddleware(BaseHTTPMiddleware):
}
if payload.get("service"):
base_context["service"] = payload["service"]
service_name = payload["service"]
base_context["service"] = service_name
base_context["type"] = "service"
base_context["role"] = "service"
base_context["user_id"] = f"{service_name}-service"
base_context["email"] = f"{service_name}-service@internal"
logger.debug(f"Service authentication: {payload['service']}")
return base_context