harlanc / xiu

A simple,high performance and secure live media server in pure Rust (RTMP[cluster]/RTSP/WebRTC[whip/whep]/HTTP-FLV/HLS).🦀
https://www.rustxiu.com
MIT License
1.6k stars 168 forks source link

Support stats #104

Open danielboros1990 opened 4 months ago

danielboros1990 commented 4 months ago

Hi there.

It would be nice if Xiu would have a statistics api, like ingress/egress data or connected users etc. :)

kumaraguru1735 commented 4 months ago

+1 need like SRS media server

kumaraguru1735 commented 4 months ago

Or Can we build like Flussonic, I can help you on web pages...

harlanc commented 4 months ago

xiu now implement a API to query statistic information of ingress data: https://www.rustxiu.com/v0.12.4/docs/httpapi/http-api#query-stream-information.

kumaraguru1735 commented 4 months ago

@harlanc How to query a particular stream key?

harlanc commented 4 months ago

 @kumaraguru1735 not yet implemented..Can you show what data Flussonic service collects and how it is displayed?

kumaraguru1735 commented 4 months ago

I am currently using SRS a opensource library https://ossrs.io/lts/en-us/docs/v5/doc/getting-started and created frontend and own API system for CMS As I love Flussonic Pull and MultiStream option, I am also developing CMS system for that https://flussonic.com/doc/api/reference/

DanielZelei commented 4 months ago

Hi @harlanc ,

Thank you for this library and for always adding new features :+1: :champagne: . I really like the project. The only thing I miss, compared to SRS, is detailed statistics. I'm setting up a project for a client where I need to know the amount of bytes used (both incoming and outgoing) by each stream and client over a specific time (I can see when the streaming started)

If I got it right, I can't get this information from the current stats API. For example, here's a response from the SRS stats API:

{
    "code": 0,
    "server": "vid-q95bj4i",
    "service": "mlyo4o82",
    "pid": "1",
    "streams": [
        {
            "id": "vid-40n2t7q",
            "name": "livestream",
            "vhost": "vid-6ul3cc3",
            "app": "live",
            "tcUrl": "rtmp://34.65.58.34/live",
            "url": "/live/livestream",
            "live_ms": 1707915749199,
            "clients": 2,
            "frames": 862,
            "send_bytes": 560320,
            "recv_bytes": 1860487,
            "kbps": {
                "recv_30s": 0,
                "send_30s": 0
            },
            "publish": {
                "active": true,
                "cid": "z5y44205"
            },
            "video": {
                "codec": "H264",
                "profile": "High",
                "level": "3.1",
                "width": 960,
                "height": 544
            },
            "audio": null
        }
    ]
}
kumaraguru1735 commented 4 months ago

wright , for more info I will you on discord ?

harlanc commented 3 months ago

@danielboros1990 @kumaraguru1735 @DanielZelei An improved version about HTTP-API to query stream statistic data has been released, any questions please let me know. Doc

kumaraguru1735 commented 3 months ago

It's better to have api for streams info seperately

And api to get a specific stream info seperately

Api to get all clients info seperately

Api to get specific client info seperately

Kick Out stream or clients on single api using id