Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
```
# Compiled Python files
*.pyc
# Python
__pycache__/
*.pyc
*.pyo
*.pyd

# Generated images
*.png
# Testing
.pytest_cache/
.coverage
coverage/
htmlcov/

# Logs and temporary files
# Logs
*.log
*.tmp

# Environment
.env
.env.local
*.env.*

# Dependencies
.venv/
venv/
virtualenv/
pip-log.txt
pip-delete-this-directory.txt

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Build
build/
dist/
*.egg-info/
```
Binary file added charts/latency_leaderboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added charts/performance_radar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/__pycache__/safety_gating.cpython-312.pyc
Binary file not shown.
Binary file modified tests/__pycache__/system_metrics.cpython-312.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/integration/test_basic_coverage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pytest
import pytest
import sys
import os

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_full_coverage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pytest
import pytest
import sys
import os
sys.path.append('phase3_automation_phase4_cognitive/scripts')
Expand Down
74 changes: 38 additions & 36 deletions tests/monitoring_test.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
import sys
sys.path.append('scripts')
from production_logger import ProductionLogger
from metrics_exporter import metrics_exporter

print("=== PRODUCTION MONITORING TEST ===")

# Initialize monitoring
logger = ProductionLogger()
logger.log_system_event("monitoring_test", {"status": "initialized"})

# Start metrics server in background
import threading
def start_metrics():
metrics_exporter.start_metrics_server()
import sys
import os

metrics_thread = threading.Thread(target=start_metrics, daemon=True)
metrics_thread.start()
# Add tests directory to path for imports
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

# Simulate activity
logger.log_detection_event("yes", 0.996, 3.64, "neutral", 0.015)
metrics_exporter.record_kws_latency(3.64)
metrics_exporter.record_wakeword_detection('yes')

logger.log_safety_event("shutdown", "blocked", "safety_mode_active")
metrics_exporter.record_safety_block()

print("✅ Production monitoring systems: OPERATIONAL")
print("📈 Metrics available at: http://localhost:8000")
print("📝 Logs writing to: logs/edgetinyml_*.log")
print("Press Ctrl+C to stop...")

try:
while True:
import time
time.sleep(1)
except KeyboardInterrupt:
print("Monitoring test completed")
from production_logger import ProductionLogger
from system_metrics import metrics_exporter

def run_monitoring_test():
"""Run production monitoring test"""
print("=== PRODUCTION MONITORING TEST ===")

# Initialize monitoring
logger = ProductionLogger()
logger.log_system_event("monitoring_test", {"status": "initialized"})

# Start metrics server in background
import threading
def start_metrics():
metrics_exporter.start_metrics_server()

metrics_thread = threading.Thread(target=start_metrics, daemon=True)
metrics_thread.start()

# Simulate activity
logger.log_detection_event("yes", 0.996, 3.64, "neutral", 0.015)
metrics_exporter.record_kws_latency(3.64)
metrics_exporter.record_wakeword_detection('yes')

logger.log_safety_event("shutdown", "blocked", "safety_mode_active")
metrics_exporter.record_safety_block()

print("✅ Production monitoring systems: OPERATIONAL")
print("📈 Metrics available at: http://localhost:8000")
print("📝 Logs writing to: logs/edgetinyml_*.log")
print("Test completed successfully!")

if __name__ == "__main__":
run_monitoring_test()
2 changes: 1 addition & 1 deletion tests/perf/kws_advanced_optimization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import time
import time
import numpy as np
import tensorflow as tf
import os
Expand Down
2 changes: 1 addition & 1 deletion tests/perf/kws_detailed_analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import time
import time
import numpy as np
import tensorflow as tf

Expand Down
2 changes: 1 addition & 1 deletion tests/perf/kws_optimized_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tensorflow as tf
import tensorflow as tf
import time
import os

Expand Down
2 changes: 1 addition & 1 deletion tests/perf/windows_optimized_bench.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tensorflow as tf
import tensorflow as tf
import time
import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion tests/resilience/flood_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import threading
import threading
import time
import random
from concurrent.futures import ThreadPoolExecutor
Expand Down
6 changes: 6 additions & 0 deletions tests/resilience/time_warp_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# tests/resilience/time_warp_test.py
import time
import datetime
import sys
import os

# Add parent tests directory to path for imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from system_metrics import ProductionLogger

def test_time_changes():
Expand Down
2 changes: 1 addition & 1 deletion tests/safety_gating.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import time
import time

class SafetyGatingSystem:
def __init__(self):
Expand Down
8 changes: 7 additions & 1 deletion tests/security/command_injection_mass_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import time
import time
import sys
import os

# Add parent tests directory to path for imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from safety_gating import SafetyGatingSystem

def test_destructive_commands():
Expand Down
2 changes: 1 addition & 1 deletion tests/security/file_corruption_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import os
import shutil
import time

Expand Down
2 changes: 1 addition & 1 deletion tests/security/security_validation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sys
import sys
import os
sys.path.append('phase3_automation_phase4_cognitive/scripts')

Expand Down
2 changes: 1 addition & 1 deletion tests/security/test_safety_gating.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pytest
import pytest
import os
import sys
sys.path.append('phase3_automation_phase4_cognitive/scripts')
Expand Down
2 changes: 1 addition & 1 deletion tests/stress/cpu_saturation_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import psutil
import psutil
import threading
import time
import numpy as np
Expand Down
4 changes: 3 additions & 1 deletion tests/stress/disk_io_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import threading
import threading
import time
import json
import os
Expand Down Expand Up @@ -35,6 +35,8 @@ def disk_writer(stop_event):
def run_disk_io_test(duration_minutes=1): # Reduced duration
print("🚨 STARTING DISK I/O OVERLOAD TEST")

import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from system_metrics import ProductionLogger

stop_event = threading.Event()
Expand Down
2 changes: 1 addition & 1 deletion tests/stress/memory_starvation_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import psutil
import psutil
import time
import numpy as np

Expand Down
23 changes: 21 additions & 2 deletions tests/system_metrics.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import psutil
import psutil
import time
import json
import os
from datetime import datetime
from prometheus_client import start_http_server, Histogram, Counter, Gauge

# Graceful prometheus_client handling
try:
from prometheus_client import start_http_server, Histogram, Counter, Gauge
HAS_PROMETHEUS = True
except ImportError:
HAS_PROMETHEUS = False
# Mock classes for when prometheus is not installed
class Histogram:
def __init__(self, *args, **kwargs): pass
def labels(self, **kwargs): return self
def observe(self, value): pass
class Counter:
def __init__(self, *args, **kwargs): pass
def labels(self, **kwargs): return self
def inc(self, value=1): pass
class Gauge:
def __init__(self, *args, **kwargs): pass
def set(self, value): pass
def start_http_server(port): pass

class ProductionLogger:
def __init__(self, log_dir="../logs"):
Expand Down
Loading