mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Add commands sent statistic
Track RCON commands sent.
This commit is contained in:
1 parent
75067e992d
commit
99ac8f4f33
2 files changed
+13
No files matched your search
@@ -36,6 +36,7 @@ Version 2.0.0
|
||||
- Added config to specify which path the master interface is accessed under,
|
||||
allowing it to be proxied behind web-server.
|
||||
- Added WebSocket usage statistics.
|
||||
- Added commands sent statistic.
|
||||
|
||||
### Changes
|
||||
|
||||
|
||||
@@ -16,6 +16,12 @@ const luaTools = require('lib/luaTools');
|
||||
const config = require('lib/config');
|
||||
|
||||
|
||||
const instanceRconCommandsCounter = new prometheus.Counter(
|
||||
"clusterio_instance_rcon_commands_total",
|
||||
"How many commands have been sent to the instance",
|
||||
{ labels: ["instance_id"] }
|
||||
);
|
||||
|
||||
/**
|
||||
* Keeps track of the runtime parameters of an instance
|
||||
*/
|
||||
@@ -39,6 +45,12 @@ class Instance extends link.Link{
|
||||
factorioDir, this._dir, serverOptions
|
||||
);
|
||||
|
||||
let originalSendRcon = this.server.sendRcon;
|
||||
this.server.sendRcon = (...args) => {
|
||||
instanceRconCommandsCounter.labels(String(this.config.get("instance.id"))).inc();
|
||||
return originalSendRcon.call(this.server, ...args);
|
||||
}
|
||||
|
||||
this.server.on('output', (output) => {
|
||||
link.messages.instanceOutput.send(this, { instance_id: this.config.get("instance.id"), output })
|
||||
|
||||
|
||||
Reference in new issue
Block a user