This commit is contained in:
Mateusz Gruszczyński
2026-08-16 11:46:35 +02:00
parent e8e5515e24
commit e5d344622e
22 changed files with 3511 additions and 11 deletions
+29
View File
@@ -5,12 +5,14 @@ import signal
import threading
import time
from datetime import datetime, timezone
from pathlib import Path
from urllib.parse import urlparse
from .analytics_cache import AnalyticsSnapshotCache
from .config import Config
from .live import EventBus, LiveEventPipeline, TrafficHistory
from .maintenance import storage_info
from .metrics import PrometheusMetrics
from .rules import RuleManager
from .state import RuntimeStats
from .store import AlertStore
@@ -231,6 +233,32 @@ def main() -> int:
"runtime": stats.snapshot(),
}
version_path = Path(__file__).resolve().parents[1] / "VERSION"
try:
app_version = version_path.read_text(encoding="ascii").strip() or "unknown"
except OSError:
app_version = "unknown"
prometheus_metrics = PrometheusMetrics(
stats,
version=app_version,
mode="web-only-development",
started_at=started_at,
state_provider=lambda: {
"components": {"web": True},
"features": {
"auto_block": False,
"ndr": False,
"notifications": False,
"routeros": False,
"redis_managed": False,
"forensic_pcap": False,
},
},
event_bus=event_bus,
live_pipeline=live_pipeline,
)
web = WebServer(
cfg,
store,
@@ -241,6 +269,7 @@ def main() -> int:
event_bus=event_bus,
live_pipeline=live_pipeline,
analytics_cache=analytics_cache,
metrics_provider=prometheus_metrics.render,
)
def request_stop(_signum=None, _frame=None) -> None: