mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 00:13:13 +09:00
Added more websocket utilization metrics
This commit is contained in:
1 parent
f15ce3fb23
commit
355e8974a4
2 files changed
+4
No files matched your search
@@ -39,6 +39,7 @@ mod_cache.json
|
|||||||
static/pictures/spritesheet.js
|
static/pictures/spritesheet.js
|
||||||
static/pictures/spritesheet.png
|
static/pictures/spritesheet.png
|
||||||
static/external
|
static/external
|
||||||
|
saves
|
||||||
|
|
||||||
# weird pattern to ignore sharedPlugins except not ignore some core modules
|
# weird pattern to ignore sharedPlugins except not ignore some core modules
|
||||||
!sharedPlugins/
|
!sharedPlugins/
|
||||||
|
|||||||
@@ -935,6 +935,7 @@ class wsSlave {
|
|||||||
// handle command return values
|
// handle command return values
|
||||||
this.commandsWaitingForReturn = {};
|
this.commandsWaitingForReturn = {};
|
||||||
this.socket.on("runCommandReturnValue", resp => {
|
this.socket.on("runCommandReturnValue", resp => {
|
||||||
|
prometheusWsUsageCounter.labels('runCommandReturnValue').inc();
|
||||||
if(resp.commandID && resp.body && this.commandsWaitingForReturn[resp.commandID] && this.commandsWaitingForReturn[resp.commandID].callback && typeof this.commandsWaitingForReturn[resp.commandID].callback == "function"){
|
if(resp.commandID && resp.body && this.commandsWaitingForReturn[resp.commandID] && this.commandsWaitingForReturn[resp.commandID].callback && typeof this.commandsWaitingForReturn[resp.commandID].callback == "function"){
|
||||||
this.commandsWaitingForReturn[resp.commandID].callback(resp.body);
|
this.commandsWaitingForReturn[resp.commandID].callback(resp.body);
|
||||||
delete this.commandsWaitingForReturn[resp.commandID];
|
delete this.commandsWaitingForReturn[resp.commandID];
|
||||||
@@ -942,6 +943,7 @@ class wsSlave {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on("gameChat", data => {
|
this.socket.on("gameChat", data => {
|
||||||
|
prometheusWsUsageCounter.labels('gameChat').inc();
|
||||||
if(typeof data === "object"){
|
if(typeof data === "object"){
|
||||||
data.timestamp = Date.now();
|
data.timestamp = Date.now();
|
||||||
if(!global.wsChatRecievers) global.wsChatRecievers = [];
|
if(!global.wsChatRecievers) global.wsChatRecievers = [];
|
||||||
@@ -952,6 +954,7 @@ class wsSlave {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on("alert", alert => {
|
this.socket.on("alert", alert => {
|
||||||
|
prometheusWsUsageCounter.labels('alert').inc();
|
||||||
if(typeof alert === "object"){
|
if(typeof alert === "object"){
|
||||||
alert.timestamp = Date.now();
|
alert.timestamp = Date.now();
|
||||||
if(!global.wsAlertRecievers) global.wsAlertRecievers = [];
|
if(!global.wsAlertRecievers) global.wsAlertRecievers = [];
|
||||||
|
|||||||
Reference in new issue
Block a user