mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-06 06:42:51 +03:00
Add a notice registry and System Health tab (#24178)
* add a notice registry and System Health tab Problems Frigate detects on its own (ffmpeg crash loops, stuck detectors, failed model downloads, recordings deleted before their retention period) only ever existed as log lines. This adds a `NoticeRegistry` in the main process backed by two tables, an `update_notice` IPC topic so producers in other processes can reach it through the dispatcher, an admin-only API and websocket topic, and a Health tab that lists them. Kinds declare their own mode, severity, and category in one place: state notices are resolved by their producer, event notices are dismissed by the user. * treat a prerelease as behind its final release * fix notices clearing early * rename menu items and update docs * don't resolve the update notice on a failed version lookup
This commit is contained in:
committed by
Nicolas Mowen
parent
af60d2db48
commit
f3a31e2fb4
@@ -1,6 +1,7 @@
|
||||
"""Utilities for stats."""
|
||||
|
||||
import logging
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
from json import JSONDecodeError
|
||||
@@ -45,6 +46,42 @@ def get_latest_version(config: FrigateConfig) -> str:
|
||||
return "unknown"
|
||||
|
||||
|
||||
def _version_tuple(value: str) -> tuple[int, int, int] | None:
|
||||
match = re.match(r"^(\d+)\.(\d+)\.(\d+)", value or "")
|
||||
|
||||
if match is None:
|
||||
return None
|
||||
|
||||
return int(match.group(1)), int(match.group(2)), int(match.group(3))
|
||||
|
||||
|
||||
# a build's git hash suffix is not a prerelease marker
|
||||
PRERELEASE_PATTERN = re.compile(r"^\d+\.\d+\.\d+-(?:beta|rc)", re.IGNORECASE)
|
||||
|
||||
|
||||
def _is_prerelease(value: str) -> bool:
|
||||
return PRERELEASE_PATTERN.match(value or "") is not None
|
||||
|
||||
|
||||
def is_newer_version(current: str, latest: str) -> bool:
|
||||
"""Whether latest is a release newer than the running version.
|
||||
|
||||
Build suffixes after the third number are ignored, and a value that does
|
||||
not parse (disabled, unknown) is never newer. A prerelease is behind the
|
||||
final release of the same number, so 0.19.0-beta2 is behind 0.19.0.
|
||||
"""
|
||||
current_tuple = _version_tuple(current)
|
||||
latest_tuple = _version_tuple(latest)
|
||||
|
||||
if current_tuple is None or latest_tuple is None:
|
||||
return False
|
||||
|
||||
if current_tuple == latest_tuple:
|
||||
return _is_prerelease(current) and not _is_prerelease(latest)
|
||||
|
||||
return latest_tuple > current_tuple
|
||||
|
||||
|
||||
def stats_init(
|
||||
config: FrigateConfig,
|
||||
camera_metrics: DictProxy,
|
||||
|
||||
Reference in New Issue
Block a user