From 72099811ad9dda4622ccb481207c05adfdb527b1 Mon Sep 17 00:00:00 2001 From: manushak Date: Mon, 22 Apr 2024 08:35:30 +0400 Subject: [PATCH 1/2] fix(lib): convert 'cpu/utilization' to number --- src/lib/azure-importer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/azure-importer/index.ts b/src/lib/azure-importer/index.ts index 57f4682..02785e0 100644 --- a/src/lib/azure-importer/index.ts +++ b/src/lib/azure-importer/index.ts @@ -70,7 +70,7 @@ export const AzureImporter = (): PluginInterface => { ) => { return rawResults.timestamps.map((timestamp, index) => ({ 'cloud/vendor': 'azure', - 'cpu/utilization': rawResults.cpuUtilizations[index], + 'cpu/utilization': parseFloat(rawResults.cpuUtilizations[index]), 'memory/available/GB': parseFloat(rawResults.memAvailable[index]) * 1e-9, 'memory/used/GB': parseFloat(rawMetadataResults.totalMemoryGB) - From 1e1899d28376c9ecae3052b5f41310826086002f Mon Sep 17 00:00:00 2001 From: manushak Date: Mon, 22 Apr 2024 08:36:21 +0400 Subject: [PATCH 2/2] test(lib): fix 'cpu/utilization' to be number --- src/__tests__/unit/lib/azure-importer/index.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/unit/lib/azure-importer/index.test.ts b/src/__tests__/unit/lib/azure-importer/index.test.ts index f905fb0..a67869e 100644 --- a/src/__tests__/unit/lib/azure-importer/index.test.ts +++ b/src/__tests__/unit/lib/azure-importer/index.test.ts @@ -102,7 +102,7 @@ describe('lib/azure-importer: ', () => { 'azure-subscription-id': '9de7e19f-8a18-4e73-9451-45fc74e7d0d3', 'azure-resource-group': 'vm1_group', 'azure-vm-name': 'vm1', - 'cpu/utilization': '3.14', + 'cpu/utilization': 3.14, 'memory/available/GB': 0.5, 'memory/used/GB': 0.5, 'memory/capacity/GB': 1, @@ -144,7 +144,7 @@ describe('lib/azure-importer: ', () => { 'azure-subscription-id': '9de7e19f-8a18-4e73-9451-45fc74e7d0d3', 'azure-resource-group': 'vm1_group', 'azure-vm-name': 'vm1', - 'cpu/utilization': '3.14', + 'cpu/utilization': 3.14, 'memory/available/GB': 0.5, 'memory/used/GB': 0.5, 'memory/capacity/GB': 1,