Compare commits

..

2 commits

Author SHA1 Message Date
Rahix c031fa5a43 succd: Add metrics for RP and RP operating time
All checks were successful
/ test (push) Successful in 10s
/ test (pull_request) Successful in 10s
Add counter metrics that count the total operating time for the roughing
pump and the diffusion pump.
2024-10-07 07:42:42 +02:00
Rahix 0aba323779 succd: Export all process values as prometheus metrics
All checks were successful
/ test (pull_request) Successful in 10s
/ test (push) Successful in 9s
For more detailed monitoring, let's export all process values that are
exposed to the web API as prometheus metrics.
2024-10-07 07:42:42 +02:00

View file

@ -193,28 +193,28 @@ func (s *webServer) viewMetrics(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "# TYPE sem_pirani_volts gauge\n") fmt.Fprintf(w, "# TYPE sem_pirani_volts gauge\n")
fmt.Fprintf(w, "sem_pirani_volts %f\n", state.piraniVolts100.avg) fmt.Fprintf(w, "sem_pirani_volts %f\n", state.piraniVolts100.avg)
fmt.Fprintf(w, "# HELP sem_pirani_failsafe Whether pirani gauge failsafe mode is active (boolean)\n") fmt.Fprintf(w, "# HELP sem_pirani_failsafe_active Whether pirani gauge failsafe mode is active (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_pirani_failsafe gauge\n") fmt.Fprintf(w, "# TYPE sem_pirani_failsafe_active gauge\n")
fmt.Fprintf(w, "sem_pirani_failsafe %f\n", boolToFloat(state.safety.failsafe)) fmt.Fprintf(w, "sem_pirani_failsafe_active %f\n", boolToFloat(state.safety.failsafe))
fmt.Fprintf(w, "# HELP sem_dp_lockout Whether diffusion pump lockout is active (boolean)\n") fmt.Fprintf(w, "# HELP sem_dp_lockout_active Whether diffusion pump lockout is active (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_dp_lockout gauge\n") fmt.Fprintf(w, "# TYPE sem_dp_lockout_active gauge\n")
fmt.Fprintf(w, "sem_dp_lockout %f\n", boolToFloat(state.safety.highPressure)) fmt.Fprintf(w, "sem_dp_lockout_active %f\n", boolToFloat(state.safety.highPressure))
fmt.Fprintf(w, "# HELP sem_dp_running Whether the diffusion pump is running (boolean)\n") fmt.Fprintf(w, "# HELP sem_pump_diffusion_running Whether the diffusion pump is running (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_dp_running gauge\n") fmt.Fprintf(w, "# TYPE sem_pump_diffusion_running gauge\n")
fmt.Fprintf(w, "sem_dp_running %f\n", boolToFloat(state.dpOn)) fmt.Fprintf(w, "sem_pump_diffusion_running %f\n", boolToFloat(state.dpOn))
fmt.Fprintf(w, "# HELP sem_rp_running Whether the roughing pump is running (boolean)\n") fmt.Fprintf(w, "# HELP sem_pump_roughing_running Whether the roughing pump is running (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_rp_running gauge\n") fmt.Fprintf(w, "# TYPE sem_pump_roughing_running gauge\n")
fmt.Fprintf(w, "sem_rp_running %f\n", boolToFloat(state.rpOn)) fmt.Fprintf(w, "sem_pump_roughing_running %f\n", boolToFloat(state.rpOn))
rough, high := state.vacuumStatus() rough, high := state.vacuumStatus()
fmt.Fprintf(w, "# HELP sem_vacuum_rough_reached Whether the rough vacuum threshold has been passed (boolean)\n") fmt.Fprintf(w, "# HELP sem_vacuum_rough_reached Whether a rough vacuum has been reached (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_vacuum_rough_reached gauge\n") fmt.Fprintf(w, "# TYPE sem_vacuum_rough_reached gauge\n")
fmt.Fprintf(w, "sem_vacuum_rough_reached %f\n", boolToFloat(rough)) fmt.Fprintf(w, "sem_vacuum_rough_reached %f\n", boolToFloat(rough))
fmt.Fprintf(w, "# HELP sem_vacuum_high_reached Whether the high vacuum threshold has been passed (boolean)\n") fmt.Fprintf(w, "# HELP sem_vacuum_high_reached Whether a high vacuum has been reached (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_vacuum_high_reached gauge\n") fmt.Fprintf(w, "# TYPE sem_vacuum_high_reached gauge\n")
fmt.Fprintf(w, "sem_vacuum_high_reached %f\n", boolToFloat(high)) fmt.Fprintf(w, "sem_vacuum_high_reached %f\n", boolToFloat(high))