meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.25k stars 2.48k forks source link

New regular event in handlers for core status #3221

Closed lminiero closed 1 year ago

lminiero commented 1 year ago

This PR adds a new core event that is sent via event handlers, to provide, on a regular basis, short info on the status of the Janus server. At the moment, this includes:

While I may add more stuff in the future, this is basically it for now, as it should provide some very basic health state information that can be consumed without having to poll the Admin API or track all events that flow through.

This is an example of how the event looks like:

{
    "emitter": "MyJanusInstance",
    "type": 256,
    "subtype": 1,
    "timestamp": 1683906438598123,
    "event": {
        "status": "update",
        "info": {
            "sessions": 0,
            "handles": 0,
            "peerconnections": 0,
            "stats-period": 1
        }
    }
}

In this PR, I hardcoded the frequency of this event to 15 seconds. Not sure if it makes sense to make this configurable too, but in case it should be easy to do. Feedback welcome!

lminiero commented 1 year ago

Merging.

lminiero commented 1 year ago

Backported to 0.x too.