succd: Export temperature values to prometheus
All checks were successful
/ test (push) Successful in 11s
/ test (pull_request) Successful in 10s

Also add metrics for all the temperature and humidity measurements.
This commit is contained in:
Rahix 2024-11-10 02:04:31 +01:00
parent 4ac1b5eb32
commit edb9051708

View file

@ -233,6 +233,26 @@ func (s *webServer) viewMetrics(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "# HELP sem_vacuum_high_reached Whether a high vacuum has been reached (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))
fmt.Fprintf(w, "# HELP sem_environment_temperature_celsius Environmental temperature of the SEM, in degrees celsius\n")
fmt.Fprintf(w, "# TYPE sem_environment_temperature_celsius gauge\n")
fmt.Fprintf(w, "sem_environment_temperature_celsius %f\n", state.tempSEM)
fmt.Fprintf(w, "# HELP sem_environment_humidity_percent Environmental relative humidity of the SEM, in percent\n")
fmt.Fprintf(w, "# TYPE sem_environment_humidity_percent gauge\n")
fmt.Fprintf(w, "sem_environment_humidity_percent %f\n", state.humiditySEM)
fmt.Fprintf(w, "# HELP sem_dp_bottom_temperature_celsius Temperature of the DP bottom, in degrees celsius\n")
fmt.Fprintf(w, "# TYPE sem_dp_bottom_temperature_celsius gauge\n")
fmt.Fprintf(w, "sem_dp_bottom_temperature_celsius %f\n", state.tempDPBottom)
fmt.Fprintf(w, "# HELP sem_dp_top_temperature_celsius Temperature of the DP top, in degrees celsius\n")
fmt.Fprintf(w, "# TYPE sem_dp_top_temperature_celsius gauge\n")
fmt.Fprintf(w, "sem_dp_top_temperature_celsius %f\n", state.tempDPTop)
fmt.Fprintf(w, "# HELP sem_dp_inlet_temperature_celsius Temperature of the DP inlet flange, in degrees celsius\n")
fmt.Fprintf(w, "# TYPE sem_dp_inlet_temperature_celsius gauge\n")
fmt.Fprintf(w, "sem_dp_inlet_temperature_celsius %f\n", state.tempDPInlet)
} }
func (s *webServer) viewRoughingPumpEnable(w http.ResponseWriter, r *http.Request) { func (s *webServer) viewRoughingPumpEnable(w http.ResponseWriter, r *http.Request) {