fermentord/internal/metrics/prometheus.go

59 lines
1.2 KiB
Go

package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
const (
MetricStateIdle float64 = iota
MetricStateCooling
MetricStateHeating
)
var (
State = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "fermentord",
Subsystem: "state",
Name: "current",
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",
},
)
TemperatureSensorReadingStatus = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: "fermentord",
Subsystem: "temperature",
Name: "sensor_reading_status",
Help: "Temperature sensor reading status",
},
[]string{
"sensor",
"status",
},
)
PID = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "fermentord",
Subsystem: "pid",
Name: "variable_value",
Help: "PID variable",
},
[]string{
"var",
"pid",
},
)
)