fermentord/internal/metrics/prometheus.go

60 lines
1.2 KiB
Go
Raw Normal View History

2021-08-30 20:46:38 +00:00
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
2021-11-16 05:19:24 +00:00
const (
MetricStateIdle float64 = iota
MetricStateCooling
MetricStateHeating
)
2021-08-30 20:46:38 +00:00
var (
State = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "fermentord",
Subsystem: "state",
2021-11-16 05:19:24 +00:00
Name: "current",
2021-08-30 20:46:38 +00:00
Help: "The state of the fermentor. 0=idle, 1=cooling, 2=heating",
})
TemperatureSensorReadingDegreesCelcius = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "fermentord",
Subsystem: "temperature",
Name: "sensor_reading_degrees_celcius",
Help: "Temperature in degrees celcius.",
},
[]string{
"sensor",
},
)
2022-03-07 14:54:36 +00:00
TemperatureSensorReadingStatus = promauto.NewCounterVec(
prometheus.CounterOpts{
2021-08-30 20:46:38 +00:00
Namespace: "fermentord",
Subsystem: "temperature",
2022-03-07 14:54:36 +00:00
Name: "sensor_reading_status",
Help: "Temperature sensor reading status",
2021-08-30 20:46:38 +00:00
},
[]string{
"sensor",
2022-03-07 14:54:36 +00:00
"status",
2021-08-30 20:46:38 +00:00
},
)
2022-02-18 20:59:32 +00:00
PID = promauto.NewGaugeVec(
2021-08-30 20:46:38 +00:00
prometheus.GaugeOpts{
Namespace: "fermentord",
Subsystem: "pid",
2022-02-18 20:59:32 +00:00
Name: "variable_value",
Help: "PID variable",
2021-08-30 20:46:38 +00:00
},
[]string{
2022-02-18 20:59:32 +00:00
"var",
2021-08-30 20:46:38 +00:00
"pid",
},
)
)