You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor alert handling and improve SQL query reliability
- Enhanced the `is_alert_duplicate` function in `alertFunctions.sh` to escape single quotes in alert messages, preventing SQL injection issues.
- Updated database password handling to check for both `PGPASSWORD` and `DBPASSWORD`, improving flexibility in authentication.
- Ensured numeric validation for alert count checks, enhancing robustness against unexpected query results.
- Modified multiple monitoring scripts to conditionally check for the availability of the `send_alert` function, ensuring alerts are sent only when the function is defined, improving reliability across the monitoring system.
send_alert "${COMPONENT}""WARNING""planet_check_duration""Planet Notes check took too long: ${duration}s (threshold: ${planet_duration_threshold}s)"||true
"SELECT timestamp FROM metrics WHERE component = 'ingestion' AND metric_name = 'timestamp_test' ORDER BY timestamp DESC LIMIT 1;"2>/dev/null | tr -d ''||echo"")
157
+
# Step 2: Get timestamp as Unix epoch (more reliable than parsing date strings)
"SELECT EXTRACT(EPOCH FROM timestamp)::bigint FROM metrics WHERE component = 'ingestion' AND metric_name = 'timestamp_test' ORDER BY timestamp DESC LIMIT 1;"2>/dev/null | tr -d '[:space:]'||echo"0")
161
161
162
162
# Step 3: Verify timestamp is recent (within last minute)
0 commit comments