Initial commit for Ghaymah SRE Exam

هذا الالتزام موجود في:
2026-07-26 14:50:01 +03:00
التزام d0e5f30eac
5 ملفات معدلة مع 109 إضافات و0 حذوفات

24
q1-deploy-monitor/app.py Normal file
عرض الملف

@@ -0,0 +1,24 @@
from fastapi import FastAPI
import time
app = FastAPI()
start_time = time.time()
request_count = 0
@app.middleware("http")
def count_requests(request, call_next):
global request_count
request_count += 1
return call_next(request)
@app.get("/")
def root():
return {"message": "Welcome to Ghaymah SRE Service"}
@app.get("/health")
def health():
return {
"status": "healthy",
"uptime_seconds": round(time.time() - start_time, 2),
"total_requests": request_count
}