From 4b4f8e8d0f73fdc009330f4136605a63cf1c8242 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Mon, 7 Nov 2022 19:32:38 +0100 Subject: [PATCH] Remove instance attribute --- TODOs | 1 + src/metrics.ts | 1 - tests/aggregator.test.ts | 7 ------- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/TODOs b/TODOs index 5b63c71..006d071 100644 --- a/TODOs +++ b/TODOs @@ -1,2 +1,3 @@ - Extract PrometheusFormatter - Extract HttpServer +- Include discovery timestamp in metric diff --git a/src/metrics.ts b/src/metrics.ts index 32114bc..15ccf87 100644 --- a/src/metrics.ts +++ b/src/metrics.ts @@ -96,7 +96,6 @@ function camelCaseToSnakeCase(str: string): string { function getDeviceLabels(device: Device): Record { return { bridge: device.instance.name, - instance: device.instance.url, device_id: device.instance.deviceID, } } diff --git a/tests/aggregator.test.ts b/tests/aggregator.test.ts index bcb6ed9..4825b7e 100644 --- a/tests/aggregator.test.ts +++ b/tests/aggregator.test.ts @@ -13,7 +13,6 @@ describe('Metrics aggregator', () => { const expectedLabels = { bridge: 'Dyson bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', firmware_revision: '21.04.03', hardware_revision: 'TP02', manufacturer: 'Dyson', @@ -48,7 +47,6 @@ describe('Metrics aggregator', () => { const expectedLabelsAccessory1 = { bridge: 'TP-Link bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', firmware_revision: '1.5.6 Build 191125 Rel.083657', hardware_revision: '2.0', manufacturer: 'TP-Link', @@ -60,7 +58,6 @@ describe('Metrics aggregator', () => { const expectedLabelsAccessory2 = { bridge: 'TP-Link bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', firmware_revision: '1.5.6 Build 191125 Rel.083657', hardware_revision: '2.0', manufacturer: 'TP-Link', @@ -89,7 +86,6 @@ describe('Metrics aggregator', () => { const expectedLabels1 = { bridge: 'Harmony bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', configured_name: 'Fernbedienung', firmware_revision: '1.6.2', manufacturer: 'Logitech', @@ -101,7 +97,6 @@ describe('Metrics aggregator', () => { const expectedLabels2 = { bridge: 'Harmony bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', configured_name: 'CD', firmware_revision: '1.6.2', manufacturer: 'Logitech', @@ -113,7 +108,6 @@ describe('Metrics aggregator', () => { const expectedLabels3 = { bridge: 'Harmony bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', configured_name: 'AirPlay', firmware_revision: '1.6.2', manufacturer: 'Logitech', @@ -125,7 +119,6 @@ describe('Metrics aggregator', () => { const expectedLabels4 = { bridge: 'Harmony bridge', device_id: 'AA:AA:AA:AA:AA:AA', - instance: 'http://192.168.0.1:38333', firmware_revision: '1.6.2', manufacturer: 'Logitech', model: 'Fernbedienung Wohnzimmer',