project-management-only/home-tv-station#15: InfluxDB stats should include player count



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.3
Created: 05-Aug-24 20:51



Description

If InfluxDB stats are enabled, we should submit a player count.

Although we could scrape control files (if active), it's probably better to enable rtmp_stat and take it from there



Toggle State Changes

Activity


assigned to @btasker

verified

mentioned in commit github-mirror/Home-TV-Station@4f02962e3cb29affd1d2539d1298275a08e97b1b

Commit: github-mirror/Home-TV-Station@4f02962e3cb29affd1d2539d1298275a08e97b1b 
Author: B Tasker                            
                            
Date: 2024-08-06T18:19:56.000+01:00 

Message

feat: add periodic stats collection (project-management-only/home-tv-station#15)

+136 -4 (140 lines changed)

This is done.

The data is written with tag event set to statsrun. For each application + stream we write

  • nclients: number of active clients (excludes publishers)
  • publishers: number of publishers connected
  • bytes_out: bytes sent by the stream
  • bytes_in: bytes received by the stream
  • dropped_frames: the total number of dropped frames reported by players

Although not relevant for my usage, it's worth noting that there is currently some minor potential for mischief here.

Because idle_streams is on, the system allows players to connect to non-existent streams. This is enabled so that players tolerate the publisher disconnecting and reconnecting during episode switch-over.

But, it also means that malicious players can connect to a number of streams, causing associated stats to be written into InfluxDB, increasing cardinality in the process.