Monitoring Module#
SPDX-FileCopyrightText: 2024 DESY and the Constellation authors SPDX-License-Identifier: EUPL-1.2
- class core.monitoring.MonitoringSender(mon_port: int | None = None, **kwds: Any)#
Bases:
BaseSatelliteFrameSender mixin class for Constellation Monitoring Distribution Protocol.
Any method of inheriting classes that has the @schedule_metric decorator, will be regularly polled for new values and a corresponding Metric be sent on the monitoring port.
- register_scheduled_metric(name: str, unit: str, description: str, interval: float, value_cb: Callable[[], Any], allowed_states: list[SatelliteState] = [SatelliteState.INIT, SatelliteState.ORBIT, SatelliteState.RUN, SatelliteState.SAFE, SatelliteState.launching, SatelliteState.landing, SatelliteState.starting, SatelliteState.stopping, SatelliteState.interrupting, SatelliteState.DEAD]) None#
Register a scheduled metric
- reset_metrics() None#
Reset all metric
This removes all metrics and resets it to the ones added via the @schedule_metric decorator.
- class core.monitoring.ScheduledMetric(name: str, unit: str, description: str, interval: float, value_cb: collections.abc.Callable[[], Any], allowed_states: list[core.protocol.cscp1.SatelliteState] | None)#
Bases:
Metric- allowed_states: list[SatelliteState] | None#
- core.monitoring.schedule_metric(unit: str, interval: float, allowed_states: list[SatelliteState] | None = [SatelliteState.INIT, SatelliteState.ORBIT, SatelliteState.RUN, SatelliteState.SAFE, SatelliteState.launching, SatelliteState.landing, SatelliteState.starting, SatelliteState.stopping, SatelliteState.interrupting, SatelliteState.DEAD]) Callable[[Callable[[P], T]], Callable[[P], T]]#
Schedule a metric for a function with given interval in seconds