ghettoptt/metrics/metrics.go
2024-03-18 14:16:05 +01:00

28 lines
761 B
Go

package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
type MumbleMetricsCollector struct {
TalkSecondsTotal prometheus.Counter
PTTTogglesTotal prometheus.Counter
}
func NewMumbleMetricsCollector() *MumbleMetricsCollector {
talkSecondsTotal := promauto.NewCounter(prometheus.CounterOpts{
Name: "mumble_talk_seconds_total",
Help: "The total number of seconds a user has been talking",
})
pttTogglesTotal := promauto.NewCounter(prometheus.CounterOpts{
Name: "mumble_ptt_toggles_total",
Help: "The total number of seconds a user has been talking",
})
return &MumbleMetricsCollector{
TalkSecondsTotal: talkSecondsTotal,
PTTTogglesTotal: pttTogglesTotal,
}
}