tesla-charge-controller/charge-controller-supervisor/src/gauges.rs

84 lines
3 KiB
Rust

use super::{CHARGE_CONTROLLER_LABEL, PL_LABEL, TRISTAR_LABEL};
use lazy_static::lazy_static;
use prometheus::{register_gauge_vec, register_int_gauge_vec, GaugeVec, IntGaugeVec};
lazy_static! {
pub static ref BATTERY_VOLTAGE: GaugeVec = register_gauge_vec!(
"battery_voltage",
"Battery voltage",
&[CHARGE_CONTROLLER_LABEL]
)
.unwrap();
pub static ref TARGET_VOLTAGE: GaugeVec = register_gauge_vec!(
"target_voltage",
"Target voltage",
&[CHARGE_CONTROLLER_LABEL]
)
.unwrap();
pub static ref INPUT_CURRENT: GaugeVec = register_gauge_vec!(
"input_current",
"Internal charge current",
&[CHARGE_CONTROLLER_LABEL]
)
.unwrap();
pub static ref CHARGE_STATE: IntGaugeVec = register_int_gauge_vec!(
"charge_state",
"Regulator state",
&[CHARGE_CONTROLLER_LABEL, "state"]
)
.unwrap();
pub static ref BATTERY_TEMP: GaugeVec = register_gauge_vec!(
"battery_temp",
"Battery temperature",
&[CHARGE_CONTROLLER_LABEL]
)
.unwrap();
pub static ref PL_DUTY_CYCLE: GaugeVec =
register_gauge_vec!("pl_duty_cycle", "Duty cycle", &[PL_LABEL]).unwrap();
pub static ref PL_LOAD_CURRENT: GaugeVec = register_gauge_vec!(
"pl_internal_load_current",
"Internal load current",
&[PL_LABEL]
)
.unwrap();
pub static ref HEATSINK_TEMP: GaugeVec =
register_gauge_vec!("heatsink_temp", "Heatsink temperature", &[TRISTAR_LABEL]).unwrap();
pub static ref TRISTAR_INPUT_VOLTAGE: GaugeVec =
register_gauge_vec!("tristar_input_voltage", "Input voltage", &[TRISTAR_LABEL]).unwrap();
pub static ref TRISTAR_CHARGE_CURRENT: GaugeVec =
register_gauge_vec!("tristar_charge_current", "Charge current", &[TRISTAR_LABEL]).unwrap();
pub static ref TRISTAR_POWER_OUT: GaugeVec =
register_gauge_vec!("tristar_power_out", "Power out", &[TRISTAR_LABEL]).unwrap();
pub static ref TRISTAR_POWER_IN: GaugeVec =
register_gauge_vec!("tristar_power_in", "Power in", &[TRISTAR_LABEL]).unwrap();
pub static ref TRISTAR_MAX_ARRAY_POWER: GaugeVec = register_gauge_vec!(
"tristar_max_array_power",
"Maximum array power",
&[TRISTAR_LABEL]
)
.unwrap();
pub static ref TRISTAR_MAX_ARRAY_VOLTAGE: GaugeVec = register_gauge_vec!(
"tristar_max_array_voltage",
"Maximum array voltage",
&[TRISTAR_LABEL]
)
.unwrap();
pub static ref TRISTAR_OPEN_CIRCUIT_VOLTAGE: GaugeVec = register_gauge_vec!(
"tristar_open_circuit_voltage",
"Open circuit voltage",
&[TRISTAR_LABEL]
)
.unwrap();
pub static ref TRISTAR_TOTAL_AH_CHARGE_DAILY: GaugeVec = register_gauge_vec!(
"tristar_total_ah_charge_daily",
"Total charge daily (Ah)",
&[TRISTAR_LABEL]
)
.unwrap();
pub static ref TRISTAR_TOTAL_WH_CHARGE_DAILY: GaugeVec = register_gauge_vec!(
"tristar_total_wh_charge_daily",
"Total charge daily (Wh)",
&[TRISTAR_LABEL]
)
.unwrap();
}