Open tompointexe opened 2 years ago
Hello, this can't be done as in HLS there isn't the concept of "reader": streams are served as files with an HTTP server, and anyone can pull them.
Anyway, an alternative could be reporting the number of served files per second, or the bandwidth, hence i'm leaving this open in order to find and implement an alternative metric.
Currently, I am using http connections to the HLS port. I think it can be reliable but I don't know if 100%. I run this script every minute and save result in database
viewers=$(ss -tn | grep ':8888' | wc -l)
@dlozoya that works only if clients reuse the same HTTP connection for pulling multiple segments and keeps it open. It's an optional feature of HTTP.
Anyway, another way of implementing this could be forcing clients to store an identifier somewhere (cookies or query parameters) and making it mandatory to pull segments. But this is completely out of the HLS specification, so there may be compatibility issues.
Describe the feature
Counting HLS readers in Prometheus metrics, i think the title explains itself 😅 Thanks !