diff --git a/app.py b/app.py
index 60c3832..94852b6 100644
--- a/app.py
+++ b/app.py
@@ -1,24 +1,74 @@
from fastapi import FastAPI
+from fastapi.responses import HTMLResponse
import time
app = FastAPI()
+
start_time = time.time()
request_count = 0
-@app.middleware("http")
-def count_requests(request, call_next):
+@app.get("/")
+def read_root():
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():
+def health_check():
+ global request_count
+ request_count += 1
return {
- "status": "healthy",
+ "status": "ok",
"uptime_seconds": round(time.time() - start_time, 2),
"total_requests": request_count
}
+
+@app.get("/dashboard", response_class=HTMLResponse)
+def get_dashboard():
+ global request_count
+ request_count += 1
+
+ uptime = round(time.time() - start_time, 2)
+
+ html_content = f"""
+
+
+
+
+ Ghaymah SRE Dashboard
+
+
+
+
+
+
🚀 Ghaymah SRE Live Monitoring Dashboard
+
تحديث تلقائي كل 5 ثوانٍ
+
+
+
الحالة (Status)
+ UP (200 OK)
+
+
+
مدة التشغيل (Uptime)
+ {uptime}s
+
+
+
عدد الطلبات (Total Requests)
+ {request_count}
+
+
+
+
+
+ """
+ return html_content
diff --git a/q1-deploy-monitor/app.py b/q1-deploy-monitor/app.py
index 60c3832..94852b6 100644
--- a/q1-deploy-monitor/app.py
+++ b/q1-deploy-monitor/app.py
@@ -1,24 +1,74 @@
from fastapi import FastAPI
+from fastapi.responses import HTMLResponse
import time
app = FastAPI()
+
start_time = time.time()
request_count = 0
-@app.middleware("http")
-def count_requests(request, call_next):
+@app.get("/")
+def read_root():
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():
+def health_check():
+ global request_count
+ request_count += 1
return {
- "status": "healthy",
+ "status": "ok",
"uptime_seconds": round(time.time() - start_time, 2),
"total_requests": request_count
}
+
+@app.get("/dashboard", response_class=HTMLResponse)
+def get_dashboard():
+ global request_count
+ request_count += 1
+
+ uptime = round(time.time() - start_time, 2)
+
+ html_content = f"""
+
+
+
+
+ Ghaymah SRE Dashboard
+
+
+
+
+
+
🚀 Ghaymah SRE Live Monitoring Dashboard
+
تحديث تلقائي كل 5 ثوانٍ
+
+
+
الحالة (Status)
+ UP (200 OK)
+
+
+
مدة التشغيل (Uptime)
+ {uptime}s
+
+
+
عدد الطلبات (Total Requests)
+ {request_count}
+
+
+
+
+
+ """
+ return html_content