docstrings

This commit is contained in:
Josh Hawkins
2026-10-30 21:44:11 -05:00
parent cbd878481e
commit e3cb3412d6
11 changed files with 15 additions and 2 deletions
+4 -1
View File
@@ -101,6 +101,7 @@ def object_masks(camera: CameraConfig) -> int:
def collect(ctx: ReportContext) -> CamerasSection:
"""Count camera settings across the cameras enabled in config."""
cameras = {
name: camera
for name, camera in ctx.config.cameras.items()
@@ -171,7 +172,9 @@ def collect(ctx: ReportContext) -> CamerasSection:
)
flags["detect"] += camera.detect.enabled
flags["record"] += camera.record.enabled
flags["sub_stream_record"] += camera.record.sub.enabled
flags["sub_stream_record"] += (
camera.record.enabled and camera.record.sub.enabled
)
flags["snapshots"] += camera.snapshots.enabled
flags["audio"] += camera.audio.enabled
flags["audio_transcription"] += (
@@ -32,6 +32,7 @@ def model_source(path: str | None) -> ModelSource:
def collect(ctx: ReportContext) -> DetectionSection:
"""Describe each configured model and its measured inference speed."""
config = ctx.config
detectors = ctx.stats.get("detectors", {})
model_specs = [(model, config.devices_for_model(model)) for model in config.models]
+1
View File
@@ -86,6 +86,7 @@ def users() -> dict[UserRole, int]:
def collect(ctx: ReportContext) -> FeaturesSection:
"""Report which enrichments and integrations are configured."""
config = ctx.config
devices = ctx.stats.get("embeddings", {}).get("devices", {})
cameras = [
+1
View File
@@ -96,6 +96,7 @@ def storage(stats: dict[str, Any]) -> StorageInfo:
def collect(ctx: ReportContext) -> HardwareSection:
"""Describe the host: CPU, memory, GPUs, decoders, detectors, storage."""
return HardwareSection(
cpu_model=cpu_model(),
cpu_cores=os.cpu_count() or 0,
+1
View File
@@ -46,6 +46,7 @@ def notice_deltas(notice_stats: list[dict[str, Any]]) -> dict[Any, NoticeCounts]
def collect(ctx: ReportContext) -> HealthSection:
"""Read health figures from the latest stats and notice counts."""
service = ctx.stats.get("service", {})
embeddings = ctx.stats.get("embeddings", {})
cpu = ctx.stats.get("cpu_usages", {}).get("frigate.full_system", {}).get("cpu")
+1
View File
@@ -53,6 +53,7 @@ def kernel(release: str) -> str:
def collect(ctx: ReportContext) -> InstallSection:
"""Describe the Frigate version, image, install method, and platform."""
return InstallSection(
version=VERSION[:32],
image_variant=image_variant(os.environ.get("FRIGATE_IMAGE_VARIANT")),
+1
View File
@@ -70,6 +70,7 @@ def gather_context(
stats_emitter: "StatsEmitter | None",
notice_registry: "NoticeRegistry | None",
) -> ReportContext:
"""Snapshot the config, latest stats, and notice counts for one report."""
return ReportContext(
config=config,
stats=stats_emitter.get_latest_stats() if stats_emitter is not None else {},
+1
View File
@@ -105,6 +105,7 @@ class AnalyticsReporter(threading.Thread):
delete_state(self.state_path)
def tick(self) -> None:
"""Apply consent and send a report when one is due."""
with self._lock:
config = self.config_holder.config
+1
View File
@@ -22,6 +22,7 @@ class AnalyticsState:
def new_state() -> AnalyticsState:
"""A fresh install ID that has never attempted a report."""
return AnalyticsState(install_id=uuid4().hex, last_attempt_at=0.0)