ghettoptt/metrics/metrics.go

28 lines
761 B
Go
Raw Normal View History

2024-03-18 11:19:16 +00:00
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,
}
}