added rooms and peers count stats

This commit is contained in:
Vittorio Palmisano 2021-03-16 14:54:26 +01:00
parent 1583b779c2
commit 876d8e19cc
2 changed files with 83 additions and 7 deletions

View file

@ -15,7 +15,6 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 2,
"links": [],
"panels": [
{
@ -860,6 +859,72 @@
"alignLevel": null
}
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 3,
"x": 16,
"y": 7
},
"id": 81,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "7.4.3",
"targets": [
{
"expr": "mediasoup_rooms",
"interval": "",
"legendFormat": "Rooms",
"refId": "A"
},
{
"expr": "mediasoup_peers",
"hide": false,
"interval": "",
"legendFormat": "Peers",
"refId": "B"
}
],
"title": "",
"type": "stat"
},
{
"datasource": null,
"description": "",
@ -901,7 +966,7 @@
"gridPos": {
"h": 7,
"w": 5,
"x": 16,
"x": 19,
"y": 7
},
"id": 79,
@ -1667,5 +1732,5 @@
"timezone": "",
"title": "MediaSoup (default)",
"uid": "mediasoup-default",
"version": 9
"version": 13
}

View file

@ -7,7 +7,7 @@ const Logger = require('../Logger');
const logger = new Logger('metrics:aggregated');
//
module.exports = function(workers, rooms, peers, config)
module.exports = function(workers, rooms_, peers_, config)
{
const register = new promClient.Registry();
promClient.collectDefaultMetrics({ prefix: 'mediasoup_', register });
@ -34,6 +34,12 @@ module.exports = function(workers, rooms, peers, config)
let workers_cpu = new Stats();
let workers_memory = new Stats();
let rooms = new Stats();
rooms.push(rooms_.size);
let peers = new Stats();
peers.push(peers_.size);
// in
let video_bitrates_in = new Stats();
let audio_bitrates_in = new Stats();
@ -166,6 +172,8 @@ module.exports = function(workers, rooms, peers, config)
Object.assign(mediasoupStats, {
workers_cpu: formatStats(workers_cpu),
workers_memory: formatStats(workers_memory),
rooms: formatStats(rooms),
peers: formatStats(peers),
// in
video_bitrates_in: formatStats(video_bitrates_in),
video_scores_in: formatStats(video_scores_in),
@ -197,9 +205,12 @@ module.exports = function(workers, rooms, peers, config)
// mediasoup metrics
[
{ name: 'workers_count', statName: 'workers_cpu', statValue: 'length' },
{ name: 'workers_cpu', statName: 'workers_cpu', statValue: 'sum' },
{ name: 'workers_memory', statName: 'workers_memory', statValue: 'sum' },
{ name: 'workers_count', statName: 'workers_cpu', statValue: 'length' },
{ name: 'workers_cpu', statName: 'workers_cpu', statValue: 'sum' },
{ name: 'workers_memory', statName: 'workers_memory', statValue: 'sum' },
//
{ name: 'rooms', statName: 'rooms', statValue: 'sum' },
{ name: 'peers', statName: 'peers', statValue: 'sum' },
// audio in
{ name: 'audio_in_count', statName: 'audio_bitrates_in', statValue: 'length' },
// audio in bitrates