Repository: provectus/kafka-ui
Issue: Wrong type declaration in the Brokers Fixtures file for the value metrics
Labels: scope/frontend
status/accepted
type/chore

<!--

Don't forget to check for existing issues/discussions regarding your proposal. We might already have it.
https://github.com/provectus/kafka-ui/issues
https://github.com/provectus/kafka-ui/discussions

-->

**Describe the bug**
<!--(A clear and concise description of what the bug is.)-->
Wrong type declaration in the Brokers for the metrics value fixtures file , which leads the file to be read as an invalid one by the editor 

**Set up**
<!--
How do you run the app? Please provide as much info as possible:
1. App version (docker image version or check commit hash in the top left corner in UI)
2. Helm chart version, if you use one
3. Any IAAC configs

We might close the issue without further explanation if you don't provide such information.
-->
Latest version from the master branch.


**Steps to Reproduce**
<!-- We'd like you to provide an example setup (via docker-compose, helm, etc.) 
to reproduce the problem, especially with a complex setups. -->
Steps to reproduce the behavior:

1.  Go to the src/components/Brokers/utils/__tests__/fixtures.ts and wait and that file will be automatically picked up as a invalid type.

**Expected behavior**
<!--
(A clear and concise description of what you expected to happen)
-->
value variable should have the correct type which is number or undefined.

**Screenshots**
<!--
(If applicable, add screenshots to help explain your problem)
-->
<img width="1035" alt="image" src="https://user-images.githubusercontent.com/46796009/198612331-729e4e86-5670-44df-8ffd-2fc6bcf223f4.png">
<img width="341" alt="image" src="https://user-images.githubusercontent.com/46796009/198612495-ba141e30-ac9f-4388-a49a-9e45c7ad3849.png">



Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-react-app/src/components/Brokers/utils/__test__/fixtures.ts b/kafka-ui-react-app/src/components/Brokers/utils/__test__/fixtures.ts
index 9ab3e4b662d..310c9bc54a3 100644
--- a/kafka-ui-react-app/src/components/Brokers/utils/__test__/fixtures.ts
+++ b/kafka-ui-react-app/src/components/Brokers/utils/__test__/fixtures.ts
@@ -6,169 +6,20 @@ export const brokerMetricsPayload: BrokerMetrics = {
   metrics: [
     {
       name: 'TotalFetchRequestsPerSec',
-      canonicalName:
-        'kafka.server:name=TotalFetchRequestsPerSec,topic=_connect_status,type=BrokerTopicMetrics',
-      params: {
-        topic: '_connect_status',
-        name: 'TotalFetchRequestsPerSec',
-        type: 'BrokerTopicMetrics',
-      },
-      value: {
-        OneMinuteRate: 19.408369293127542,
-        FifteenMinuteRate: 19.44631556589501,
-        Count: 191615,
-        FiveMinuteRate: 19.464393718807774,
-        MeanRate: 19.4233855043407,
+      labels: {
+        canonicalName:
+          'kafka.server:name=TotalFetchRequestsPerSec,topic=_connect_status,type=BrokerTopicMetrics',
       },
+      value: 10,
     },
     {
       name: 'ZooKeeperRequestLatencyMs',
-      canonicalName:
-        'kafka.server:name=ZooKeeperRequestLatencyMs,type=ZooKeeperClientMetrics',
-      params: {
-        name: 'ZooKeeperRequestLatencyMs',
-        type: 'ZooKeeperClientMetrics',
-      },
-      value: {
-        Mean: 4.907351022183558,
-        StdDev: 10.589608223906348,
-        '75thPercentile': 2,
-        '98thPercentile': 10,
-        Min: 0,
-        '95thPercentile': 5,
-        '99thPercentile': 15,
-        Max: 151,
-        '999thPercentile': 92.79700000000003,
-        Count: 2301,
-        '50thPercentile': 1,
-      },
+      value: 11,
     },
     {
       name: 'RequestHandlerAvgIdlePercent',
-      canonicalName:
-        'kafka.server:name=RequestHandlerAvgIdlePercent,type=KafkaRequestHandlerPool',
-      params: {
-        name: 'RequestHandlerAvgIdlePercent',
-        type: 'KafkaRequestHandlerPool',
-      },
-      value: {
-        OneMinuteRate: 0.9999008788765713,
-        FifteenMinuteRate: 0.9983845959639047,
-        Count: 9937344680371,
-        FiveMinuteRate: 0.9986337207880311,
-        MeanRate: 0.9971616923696525,
-      },
-    },
-    {
-      name: 'BytesInPerSec',
-      canonicalName:
-        'kafka.server:name=BytesInPerSec,topic=_connect_status,type=BrokerTopicMetrics',
-      params: {
-        topic: '_connect_status',
-        name: 'BytesInPerSec',
-        type: 'BrokerTopicMetrics',
-      },
-      value: {
-        OneMinuteRate: 0,
-        FifteenMinuteRate: 0,
-        Count: 0,
-        FiveMinuteRate: 0,
-        MeanRate: 0,
-      },
-    },
-    {
-      name: 'FetchMessageConversionsPerSec',
-      canonicalName:
-        'kafka.server:name=FetchMessageConversionsPerSec,topic=__consumer_offsets,type=BrokerTopicMetrics',
-      params: {
-        topic: '__consumer_offsets',
-        name: 'FetchMessageConversionsPerSec',
-        type: 'BrokerTopicMetrics',
-      },
-      value: {
-        OneMinuteRate: 0,
-        FifteenMinuteRate: 0,
-        Count: 0,
-        FiveMinuteRate: 0,
-        MeanRate: 0,
-      },
-    },
-    {
-      name: 'TotalProduceRequestsPerSec',
-      canonicalName:
-        'kafka.server:name=TotalProduceRequestsPerSec,topic=_connect_status,type=BrokerTopicMetrics',
-      params: {
-        topic: '_connect_status',
-        name: 'TotalProduceRequestsPerSec',
-        type: 'BrokerTopicMetrics',
-      },
-      value: {
-        OneMinuteRate: 0,
-        FifteenMinuteRate: 0,
-        Count: 0,
-        FiveMinuteRate: 0,
-        MeanRate: 0,
-      },
-    },
-    {
-      name: 'MaxLag',
-      canonicalName:
-        'kafka.server:clientId=Replica,name=MaxLag,type=ReplicaFetcherManager',
-      params: {
-        clientId: 'Replica',
-        name: 'MaxLag',
-        type: 'ReplicaFetcherManager',
-      },
-      value: {
-        Value: 0,
-      },
-    },
-    {
-      name: 'UnderMinIsrPartitionCount',
-      canonicalName:
-        'kafka.server:name=UnderMinIsrPartitionCount,type=ReplicaManager',
-      params: {
-        name: 'UnderMinIsrPartitionCount',
-        type: 'ReplicaManager',
-      },
-      value: {
-        Value: 0,
-      },
-    },
-    {
-      name: 'ZooKeeperDisconnectsPerSec',
-      canonicalName:
-        'kafka.server:name=ZooKeeperDisconnectsPerSec,type=SessionExpireListener',
-      params: {
-        name: 'ZooKeeperDisconnectsPerSec',
-        type: 'SessionExpireListener',
-      },
-      value: {
-        OneMinuteRate: 0,
-        FifteenMinuteRate: 0,
-        Count: 0,
-        FiveMinuteRate: 0,
-        MeanRate: 0,
-      },
-    },
-    {
-      name: 'BytesInPerSec',
-      canonicalName:
-        'kafka.server:name=BytesInPerSec,topic=__confluent.support.metrics,type=BrokerTopicMetrics',
-      params: {
-        topic: '__confluent.support.metrics',
-        name: 'BytesInPerSec',
-        type: 'BrokerTopicMetrics',
-      },
-      value: {
-        OneMinuteRate: 3.093893673470914e-70,
-        FifteenMinuteRate: 0.004057932469784932,
-        Count: 1263,
-        FiveMinuteRate: 1.047243693828501e-12,
-        MeanRate: 0.12704831069266603,
-      },
     },
   ],
 };
 export const transformedBrokerMetricsPayload =
-  '{"segmentSize":23,"segmentCount":23,"metrics":[{"name":"TotalFetchRequestsPerSec","canonicalName":"kafka.server:name=TotalFetchRequestsPerSec,topic=_connect_status,type=BrokerTopicMetrics","params":{"topic":"_connect_status","name":"TotalFetchRequestsPerSec","type":"BrokerTopicMetrics"},"value":{"OneMinuteRate":19.408369293127542,"FifteenMinuteRate":19.44631556589501,"Count":191615,"FiveMinuteRate":19.464393718807774,"MeanRate":19.4233855043407}},{"name":"ZooKeeperRequestLatencyMs","canonicalName":"kafka.server:name=ZooKeeperRequestLatencyMs,type=ZooKeeperClientMetrics","params":{"name":"ZooKeeperRequestLatencyMs","type":"ZooKeeperClientMetrics"},"value":{"Mean":4.907351022183558,"StdDev":10.589608223906348,"75thPercentile":2,"98thPercentile":10,"Min":0,"95thPercentile":5,"99thPercentile":15,"Max":151,"999thPercentile":92.79700000000003,"Count":2301,"50thPercentile":1}},{"name":"RequestHandlerAvgIdlePercent","canonicalName":"kafka.server:name=RequestHandlerAvgIdlePercent,type=KafkaRequestHandlerPool","params":{"name":"RequestHandlerAvgIdlePercent","type":"KafkaRequestHandlerPool"},"value":{"OneMinuteRate":0.9999008788765713,"FifteenMinuteRate":0.9983845959639047,"Count":9937344680371,"FiveMinuteRate":0.9986337207880311,"MeanRate":0.9971616923696525}},{"name":"BytesInPerSec","canonicalName":"kafka.server:name=BytesInPerSec,topic=_connect_status,type=BrokerTopicMetrics","params":{"topic":"_connect_status","name":"BytesInPerSec","type":"BrokerTopicMetrics"},"value":{"OneMinuteRate":0,"FifteenMinuteRate":0,"Count":0,"FiveMinuteRate":0,"MeanRate":0}},{"name":"FetchMessageConversionsPerSec","canonicalName":"kafka.server:name=FetchMessageConversionsPerSec,topic=__consumer_offsets,type=BrokerTopicMetrics","params":{"topic":"__consumer_offsets","name":"FetchMessageConversionsPerSec","type":"BrokerTopicMetrics"},"value":{"OneMinuteRate":0,"FifteenMinuteRate":0,"Count":0,"FiveMinuteRate":0,"MeanRate":0}},{"name":"TotalProduceRequestsPerSec","canonicalName":"kafka.server:name=TotalProduceRequestsPerSec,topic=_connect_status,type=BrokerTopicMetrics","params":{"topic":"_connect_status","name":"TotalProduceRequestsPerSec","type":"BrokerTopicMetrics"},"value":{"OneMinuteRate":0,"FifteenMinuteRate":0,"Count":0,"FiveMinuteRate":0,"MeanRate":0}},{"name":"MaxLag","canonicalName":"kafka.server:clientId=Replica,name=MaxLag,type=ReplicaFetcherManager","params":{"clientId":"Replica","name":"MaxLag","type":"ReplicaFetcherManager"},"value":{"Value":0}},{"name":"UnderMinIsrPartitionCount","canonicalName":"kafka.server:name=UnderMinIsrPartitionCount,type=ReplicaManager","params":{"name":"UnderMinIsrPartitionCount","type":"ReplicaManager"},"value":{"Value":0}},{"name":"ZooKeeperDisconnectsPerSec","canonicalName":"kafka.server:name=ZooKeeperDisconnectsPerSec,type=SessionExpireListener","params":{"name":"ZooKeeperDisconnectsPerSec","type":"SessionExpireListener"},"value":{"OneMinuteRate":0,"FifteenMinuteRate":0,"Count":0,"FiveMinuteRate":0,"MeanRate":0}},{"name":"BytesInPerSec","canonicalName":"kafka.server:name=BytesInPerSec,topic=__confluent.support.metrics,type=BrokerTopicMetrics","params":{"topic":"__confluent.support.metrics","name":"BytesInPerSec","type":"BrokerTopicMetrics"},"value":{"OneMinuteRate":3.093893673470914e-70,"FifteenMinuteRate":0.004057932469784932,"Count":1263,"FiveMinuteRate":1.047243693828501e-12,"MeanRate":0.12704831069266603}}]}';
+  '{"segmentSize":23,"segmentCount":23,"metrics":[{"name":"TotalFetchRequestsPerSec","labels":{"canonicalName":"kafka.server:name=TotalFetchRequestsPerSec,topic=_connect_status,type=BrokerTopicMetrics"},"value":10},{"name":"ZooKeeperRequestLatencyMs","value":11},{"name":"RequestHandlerAvgIdlePercent"}]}';


Test patch: