mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 01:08:15 +00:00
Add desync tracking metrics (#2707)
## Description: - Added observable gauge to track total number of client desyncs detected across game servers - Tracks desyncs at the individual client level (counts each out-of-sync client) - Exposes metric as `openfront.desyncs.gauge` for monitoring ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [ ] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
This commit is contained in:
@@ -69,6 +69,8 @@ export class GameServer {
|
||||
{ winner: ClientSendWinnerMessage; ips: Set<string> }
|
||||
> = new Map();
|
||||
|
||||
public desyncCount = 0;
|
||||
|
||||
constructor(
|
||||
public readonly id: string,
|
||||
readonly log_: Logger,
|
||||
@@ -778,6 +780,8 @@ export class GameServer {
|
||||
const { mostCommonHash, outOfSyncClients } =
|
||||
this.findOutOfSyncClients(lastHashTurn);
|
||||
|
||||
this.desyncCount += outOfSyncClients.length;
|
||||
|
||||
if (outOfSyncClients.length === 0) {
|
||||
this.turns[lastHashTurn].hash = mostCommonHash;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user