From 60889d0a583eae62c5b438881397b6eb38e2c917 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Fri, 15 Apr 2022 10:33:40 +0200
Subject: [PATCH] L2SS-758: Improve 2D array and string parsing

---
 .../tango-prometheus-exporter/code/tango-prometheus-client.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py b/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py
index 28a840415..f7dc1e5e7 100644
--- a/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py
+++ b/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py
@@ -83,7 +83,7 @@ class CustomCollector(object):
         elif attr_info.data_type == ArgType.DevString:
             data_type = 'string'
             str_value = str(value)
-            float_value = 1
+            float_value = len(str_value)
         elif attr_info.data_type == ArgType.DevEnum:
             attr_config = dev.get_attribute_config(attr_info.name)
             data_type = 'enum'
@@ -124,7 +124,7 @@ class CustomCollector(object):
                 """ NOTE: We switch x and y in the annotation, to allow queries to combine 1D and 2D arrays in their first dimension using the same label (x). We effectively expose
                           the array as [x][y] instead of [y][x]. """
 
-                new_metric = self._to_metric(dev, attr_info, x, y, attr_value.value[y][x])
+                new_metric = self._to_metric(dev, attr_info, y, x, attr_value.value[y][x])
                 metrics.append(new_metric) if new_metric else None
 
         return metrics
-- 
GitLab