This repository has been archived on 2023-07-05. You can view files and clone it, but cannot push or open issues or pull requests.
clessy/stats/metrics.go

34 lines
824 B
Go

package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
opTotalMsg = promauto.NewCounter(prometheus.CounterOpts{
Name: "broker_received_total",
Help: "The total number of received messages",
})
opMsgPerChat = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "broker_received_chat",
Help: "The number of received messages per chat",
}, []string{
"chatid",
"user",
"messagetype",
})
opCommand = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "broker_received_commands",
Help: "The number of commands written in chats (or privately)",
}, []string{
"command",
})
)
func registerMetrics() {
prometheus.MustRegister(opTotalMsg)
prometheus.MustRegister(opMsgPerChat)
prometheus.MustRegister(opCommand)
}