Skip to content
Snippets Groups Projects
Commit bcb01b37 authored by Hannes Feldt's avatar Hannes Feldt
Browse files

L2SS-1554: Fix missing station state metric

parent b3f10d00
Branches
Tags
1 merge request!772L2SS-1554: Fix missing station state metric
...@@ -139,6 +139,7 @@ Next change the version in the following places: ...@@ -139,6 +139,7 @@ Next change the version in the following places:
# Release Notes # Release Notes
* 0.24.1 Let all devices emit basic prometheus metrics
* 0.24.0 Allow multiple antenna fields to be used in single observation, * 0.24.0 Allow multiple antenna fields to be used in single observation,
This renames the `Observation` device to `ObservationField`. This renames the `Observation` device to `ObservationField`.
* 0.23.0 Migrate execution environment to nomad * 0.23.0 Migrate execution environment to nomad
......
...@@ -15,7 +15,7 @@ resource "nomad_job" "tango" { ...@@ -15,7 +15,7 @@ resource "nomad_job" "tango" {
paths = ["./jobs/station/tango.nomad"] paths = ["./jobs/station/tango.nomad"]
health_check { health_check {
timeout = "300s" timeout = "1000s"
jobs = ["tango"] jobs = ["tango"]
} }
} }
...@@ -26,7 +26,7 @@ resource "nomad_job" "object-storage" { ...@@ -26,7 +26,7 @@ resource "nomad_job" "object-storage" {
paths = ["./jobs/station/object-storage.nomad"] paths = ["./jobs/station/object-storage.nomad"]
health_check { health_check {
timeout = "300s" timeout = "1000s"
jobs = ["object-storage"] jobs = ["object-storage"]
} }
} }
...@@ -50,7 +50,7 @@ job "jupyter" { ...@@ -50,7 +50,7 @@ job "jupyter" {
resources { resources {
cpu = 1024 cpu = 1024
memory = 1024 memory = 1024
memory_max = 8192 memory_max = 20480
} }
template { template {
data = <<EOH data = <<EOH
......
0.24.0 0.24.1
...@@ -38,13 +38,14 @@ from tangostationcontrol.common.type_checking import sequence_not_str ...@@ -38,13 +38,14 @@ from tangostationcontrol.common.type_checking import sequence_not_str
from tangostationcontrol.devices.base_device_classes.control_hierarchy import ( from tangostationcontrol.devices.base_device_classes.control_hierarchy import (
ControlHierarchyDevice, ControlHierarchyDevice,
) )
from tangostationcontrol.metrics import DeviceMetricCollector from tangostationcontrol.metrics import device_metrics
__all__ = ["LOFARDevice"] __all__ = ["LOFARDevice"]
logger = logging.getLogger() logger = logging.getLogger()
@device_metrics()
class LOFARDevice(Device): class LOFARDevice(Device):
""" """
...@@ -249,7 +250,6 @@ class LOFARDevice(Device): ...@@ -249,7 +250,6 @@ class LOFARDevice(Device):
# record when this device was started # record when this device was started
self.device_start_time = time.time() self.device_start_time = time.time()
DeviceMetricCollector.add_device(self)
def _init_device(self): def _init_device(self):
logger.debug("[LOFARDevice] init_device") logger.debug("[LOFARDevice] init_device")
......
...@@ -75,6 +75,9 @@ class DeviceMetricsAttribute: ...@@ -75,6 +75,9 @@ class DeviceMetricsAttribute:
@staticmethod @staticmethod
def init_device_wrapper(): def init_device_wrapper():
def new_init_device(instance): def new_init_device(instance):
from ._collectors import DeviceMetricCollector
DeviceMetricCollector.add_device(instance)
metric_values = instance.get_name().split("/") metric_values = instance.get_name().split("/")
metric_values.append(str(instance.get_device_class().get_name())) metric_values.append(str(instance.get_device_class().get_name()))
instance.metric_labels = metric_values instance.metric_labels = metric_values
...@@ -88,6 +91,8 @@ class DeviceMetricsAttribute: ...@@ -88,6 +91,8 @@ class DeviceMetricsAttribute:
self.ds_state.labels(*instance.metric_labels).set(new_state) self.ds_state.labels(*instance.metric_labels).set(new_state)
except ValueError as e: except ValueError as e:
logger.warning(e) logger.warning(e)
except AttributeError as e:
logger.warning(e)
return new_set_state return new_set_state
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment