Kushal Shah commited on
Commit
477bcb2
·
1 Parent(s): 00da95b

Remove sample data and use empty default UI fields

Browse files
app.py CHANGED
@@ -1,22 +1,17 @@
1
  import gradio as gr
2
  import os
3
- import json
4
  from dotenv import load_dotenv
5
  from agents import IncidentAgents
6
- from tools import read_log_file, read_ticket_data, read_runbook
7
 
8
  # Load environment variables
9
  load_dotenv()
10
 
11
- # --- DEFAULT DATA (sample incident, used to pre-fill the UI) ---
12
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
13
 
14
- DEFAULT_LOGS = read_log_file(os.path.join(BASE_DIR, "data", "logs", "server_logs.txt"))
15
- DEFAULT_TICKET = json.dumps(
16
- read_ticket_data(os.path.join(BASE_DIR, "data", "tickets", "incident_ticket.json")),
17
- indent=2
18
- )
19
- DEFAULT_RUNBOOK = read_runbook(os.path.join(BASE_DIR, "data", "docs", "runbook.md"))
20
 
21
  # --- 2. THE CORE WORKFLOW FUNCTION ---
22
  def run_incident_response(logs_input, ticket_input, runbook_input):
 
1
  import gradio as gr
2
  import os
 
3
  from dotenv import load_dotenv
4
  from agents import IncidentAgents
 
5
 
6
  # Load environment variables
7
  load_dotenv()
8
 
9
+ # --- DEFAULT DATA ---
10
+ DEFAULT_LOGS = ""
11
 
12
+ DEFAULT_TICKET = ""
13
+
14
+ DEFAULT_RUNBOOK = ""
 
 
 
15
 
16
  # --- 2. THE CORE WORKFLOW FUNCTION ---
17
  def run_incident_response(logs_input, ticket_input, runbook_input):
data/docs/runbook.md DELETED
@@ -1,16 +0,0 @@
1
- # Engineering Runbook: Database Connection Issues
2
-
3
- ## Error: ConnectionPoolTimeoutError
4
- **Symptoms:** - API returns 500 status codes.
5
- - Logs show "Timeout waiting for connection from pool".
6
- - Latency spikes on endpoints /api/v1/users.
7
-
8
- ## Root Causes
9
- 1. **Traffic Spike:** Sudden increase in concurrent users exceeding `MAX_CONNECTIONS`.
10
- 2. **Zombie Connections:** Application not closing connections properly (missing `.close()` or `try/finally` blocks).
11
- 3. **Database Maintenance:** DB is undergoing patches or backups.
12
-
13
- ## Remediation Steps
14
- 1. **Immediate Mitigation:** Restart the application service (`sudo systemctl restart api-service`) to flush the pool.
15
- 2. **Investigation:** Check `pg_stat_activity` for idle transactions.
16
- 3. **Long-term Fix:** Increase `MAX_CONNECTIONS` in `config.yaml` or implement connection pooling proxy (PgBouncer).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/logs/server_logs.txt DELETED
@@ -1,8 +0,0 @@
1
- 2024-10-24 14:28:10 [INFO] Request received: GET /api/v1/health - 200 OK
2
- 2024-10-24 14:29:15 [INFO] Worker process started (PID 4021)
3
- 2024-10-24 14:30:05 [WARN] Connection pool usage at 85%
4
- 2024-10-24 14:30:45 [WARN] Connection pool usage at 95% - approaching limit
5
- 2024-10-24 14:31:02 [ERROR] [PID 4021] Failed to acquire connection. Error: sqlalchemy.exc.TimeoutError: QueuePool limit of size 10 overflow 10 reached, connection timed out, timeout 30.
6
- 2024-10-24 14:31:02 [ERROR] Request failed: GET /api/v1/users/login - 500 Internal Server Error
7
- 2024-10-24 14:31:05 [ERROR] [PID 4021] Failed to acquire connection.
8
- 2024-10-24 14:31:10 [CRITICAL] Service health check failing. Database unreachable.
 
 
 
 
 
 
 
 
 
data/tickets/incident_ticket.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "ticket_id": "INC-2024-001",
3
- "priority": "P1",
4
- "status": "OPEN",
5
- "title": "API returning 500 errors on User Service",
6
- "description": "Customer reports unable to login. Monitoring dashboard shows 500 error rate spike starting at 14:30 UTC.",
7
- "reported_at": "2024-10-24T14:35:00Z"
8
- }