Files
managed-portal/managed/people_flow_project/docs/plans/2026-04-08-rtsp-heartbeat-logging-design.md
2026-04-27 10:04:36 +08:00

1.1 KiB

RTSP Heartbeat Logging Design

Date: 2026-04-08

Goal: Add periodic heartbeat logs to the RTSP pipeline so operators can confirm the stream is still being processed during long 30-minute windows.

Scope

  • Keep the existing RTSP counting behavior unchanged.
  • Print one heartbeat line every 60 seconds while the RTSP loop is running.
  • Include the current demographic counts in the heartbeat output.
  • Do not change JSON payload structure or window timing.

Heartbeat Format

Each heartbeat line should report:

  • runtime seconds
  • current window index
  • current window frame count
  • total people in the active window
  • age counts
  • gender counts
  • unknown attributes
  • last processed timestamp

This output is intended for tail -f style monitoring and should remain single-line and compact.

Approach

Reuse the existing live stats helper to avoid recomputing counting rules in a second place. The RTSP loop already knows when each sampled frame is processed, so it can track the last successful processing timestamp and emit a heartbeat when 60 seconds have elapsed since the last log.