Skip to content

Commit

Permalink
Merge branch 'main' into update-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio1988 authored Nov 28, 2023
2 parents dbd5d8d + 55ea8fc commit a9892b1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,13 @@ setInterval(() => {
Object.entries(controlConnections).forEach(([, connection]) => {
const origin = connection?.origin || 'Unknown';
connectedDevices += 1;
deviceMemoryFree.labels(origin).set(connection.lastMemory.memFree || 0);
deviceMemoryMitm.labels(origin).set(connection.lastMemory.memMitm || 0);
deviceMemoryStart.labels(origin).set(connection.lastMemory.memStart || 0);

const validMemFree = Number.isFinite(connection.lastMemory.memFree) ? connection.lastMemory.memFree : 0;
deviceMemoryFree.labels(origin).set(validMemFree);
const validMemMitm = Number.isFinite(connection.lastMemory.memMitm) ? connection.lastMemory.memMitm : 0;
deviceMemoryMitm.labels(origin).set(validMemMitm);
const validMemStart = Number.isFinite(connection.lastMemory.memStart) ? connection.lastMemory.memStart : 0;
deviceMemoryStart.labels(origin).set(validMemStart);
});
// set number of active devices (couldn't get it correct with add/removal signals ; missed some decrement)
devicesGauge.set(connectedDevices);
Expand All @@ -343,7 +347,8 @@ setInterval(() => {

// set workers
Object.entries(originActiveWorkers).forEach(([name, number]) => {
workersGauge.labels(name).set(number || 0);
const validNumber = Number.isFinite(number) ? number : 0;
workersGauge.labels(name).set(validNumber);
});
}, 5000);

Expand Down

0 comments on commit a9892b1

Please sign in to comment.