From 6ed56361f4ea726edeb36d4d3e233b2e3010d9f7 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Wed, 6 Mar 2024 18:27:20 +0000 Subject: [PATCH] Fix type annotations in BasicMetrics.ts --- InfrastructureAgent/Utils/BasicMetrics.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/InfrastructureAgent/Utils/BasicMetrics.ts b/InfrastructureAgent/Utils/BasicMetrics.ts index f746ff3ef1..d0d5f60d3b 100644 --- a/InfrastructureAgent/Utils/BasicMetrics.ts +++ b/InfrastructureAgent/Utils/BasicMetrics.ts @@ -24,7 +24,7 @@ export class BasicMetircs { public static async getDiskUsage( diskPath: string ): Promise { - const info = await diskusage.check(diskPath); + const info: diskusage.DiskUsage = await diskusage.check(diskPath); return { total: info.total, @@ -36,9 +36,9 @@ export class BasicMetircs { } public static async getMemoryMetrics(): Promise { - const totalMemory = os.totalmem(); - const freeMemory = os.freemem(); - const usedMemory = totalMemory - freeMemory; + const totalMemory: number = os.totalmem(); + const freeMemory: number = os.freemem(); + const usedMemory: number = totalMemory - freeMemory; return { total: totalMemory, @@ -48,7 +48,7 @@ export class BasicMetircs { } public static async getCPUMetrics(): Promise { - const cpuUsage = os.loadavg()[0]; // Returns an array containing the 1, 5, and 15 minute load averages. + const cpuUsage: number | undefined = os.loadavg()[0]; // Returns an array containing the 1, 5, and 15 minute load averages. return { percentUsage: cpuUsage || 0,