Skip to content
Snippets Groups Projects
Commit fbf352bd authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-359: Don't monitor our big 2D arrays

parent c772f89e
Branches
Tags
1 merge request!106Resolve L2SS-359 "Add grafana"
...@@ -65,6 +65,10 @@ class CustomCollector(object): ...@@ -65,6 +65,10 @@ class CustomCollector(object):
def add_to_metric_image(self, dev, attr_info, metric): def add_to_metric_image(self, dev, attr_info, metric):
attr_value = dev.read_attribute(attr_info.name) attr_value = dev.read_attribute(attr_info.name)
if attr_value.dim_x * attr_value.dim_y > 256:
# too big, don't monitor
return 0
for y in range(int(attr_value.dim_y)): for y in range(int(attr_value.dim_y)):
for x in range(int(attr_value.dim_x)): for x in range(int(attr_value.dim_x)):
""" 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 """ 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
...@@ -176,7 +180,7 @@ class CustomCollector(object): ...@@ -176,7 +180,7 @@ class CustomCollector(object):
res = self.add_to_metric_spectrum(dev, attr_info, attribute_metrics) res = self.add_to_metric_spectrum(dev, attr_info, attribute_metrics)
if(res <= 0): if(res <= 0):
not_managed_attribute_count += 1 not_managed_attribute_count += 1
#print("*******NOT MANAGED: "+attr_info.name) print("*******NOT MANAGED: "+attr_info.name)
else: else:
spectrum_count += 1 spectrum_count += 1
read_count += 1 read_count += 1
...@@ -185,14 +189,14 @@ class CustomCollector(object): ...@@ -185,14 +189,14 @@ class CustomCollector(object):
res = self.add_to_metric_image(dev, attr_info, attribute_metrics) res = self.add_to_metric_image(dev, attr_info, attribute_metrics)
if(res <= 0): if(res <= 0):
not_managed_attribute_count += 1 not_managed_attribute_count += 1
#print("*******NOT MANAGED: "+attr_info.name) print("*******NOT MANAGED: "+attr_info.name)
else: else:
image_count += 1 image_count += 1
read_count += 1 read_count += 1
else: else:
# AttrDataFormat.FMT_UNKNOWN # AttrDataFormat.FMT_UNKNOWN
not_managed_attribute_count += 1 not_managed_attribute_count += 1
#print("*******NOT MANAGED: "+attr_info.name) print("*******NOT MANAGED: "+attr_info.name)
except Exception as e1: except Exception as e1:
#print ("Could not connect to the '"+ class_list[j] + "." + attr_info.name+"' Attribute.\r\n") #print ("Could not connect to the '"+ class_list[j] + "." + attr_info.name+"' Attribute.\r\n")
#print(e1) #print(e1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment