feat: add server latency to the influx points
This commit is contained in:
parent
ab53e24978
commit
98cb26e310
@ -69,6 +69,7 @@ export default class Server {
|
|||||||
* @returns the ping response or undefined if the server is offline
|
* @returns the ping response or undefined if the server is offline
|
||||||
*/
|
*/
|
||||||
public async pingServer(): Promise<Ping | undefined> {
|
public async pingServer(): Promise<Ping | undefined> {
|
||||||
|
const before = Date.now();
|
||||||
try {
|
try {
|
||||||
let response;
|
let response;
|
||||||
|
|
||||||
@ -92,6 +93,7 @@ export default class Server {
|
|||||||
new Point("playerCount")
|
new Point("playerCount")
|
||||||
.tag("name", this.getName())
|
.tag("name", this.getName())
|
||||||
.intField("playerCount", response.playerCount)
|
.intField("playerCount", response.playerCount)
|
||||||
|
.intField("latency", Date.now() - before)
|
||||||
.timestamp(response.timestamp)
|
.timestamp(response.timestamp)
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user