Archive more devices in general by using wild-card matching, avoid archiving...
Compare changes
@@ -2,31 +2,39 @@ import time
@@ -2,31 +2,39 @@ import time
@@ -38,7 +46,7 @@ class ArchiverPolicy(object):
@@ -38,7 +46,7 @@ class ArchiverPolicy(object):
@@ -52,7 +60,7 @@ class ArchiverPolicy(object):
@@ -52,7 +60,7 @@ class ArchiverPolicy(object):
@@ -66,14 +74,21 @@ class ArchiverPolicy(object):
@@ -66,14 +74,21 @@ class ArchiverPolicy(object):
@@ -88,6 +103,7 @@ class ArchiverPolicy(object):
@@ -88,6 +103,7 @@ class ArchiverPolicy(object):
@@ -95,43 +111,65 @@ class CustomCollector(object):
@@ -95,43 +111,65 @@ class CustomCollector(object):
if attr_info.data_type in [ArgType.DevShort, ArgType.DevLong, ArgType.DevUShort, ArgType.DevULong, ArgType.DevLong64, ArgType.DevULong64, ArgType.DevInt, ArgType.DevFloat, ArgType.DevDouble]:
return ([self.station, dev.dev_name(), attr_info.name, str_value, data_type, f"{x:02}", f"{y:02}", f"{idx:03}"], float_value)
@@ -141,21 +179,28 @@ class CustomCollector(object):
@@ -141,21 +179,28 @@ 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
new_metric = self._to_metric(dev, attr_info, y, x, y * attr_value.dim_x + x, attr_value.value[y][x])
@@ -167,16 +212,25 @@ class CustomCollector(object):
@@ -167,16 +212,25 @@ class CustomCollector(object):
@@ -195,20 +249,30 @@ class CustomCollector(object):
@@ -195,20 +249,30 @@ class CustomCollector(object):
attribute_metrics = GaugeMetricFamily("device_attribute", 'Device attribute value', labels=['station', 'device', 'name', 'str_value', 'type', 'x', 'y', 'idx'])
scraping_metrics = GaugeMetricFamily("device_scraping", 'Device scraping duration', labels=['station', 'device'])
@@ -226,9 +290,13 @@ class CustomCollector(object):
@@ -226,9 +290,13 @@ class CustomCollector(object):
logger.info(f"Done processing device {device_name}. Took {dev_scrape_end - dev_scrape_begin} seconds.")
@@ -238,20 +306,39 @@ class CustomCollector(object):
@@ -238,20 +306,39 @@ class CustomCollector(object):
parser.add_argument('-t', '--timeout', type=int, required=False, default=250, help='device proxy timeout (ms)')
parser.add_argument('-p', '--port', type=int, required=False, default=8000, help='HTTP server port to open')