Prometheus counter for Signal/RTC messages (#139)

This commit is contained in:
Mathew Kamkar
2021-10-08 12:02:08 -07:00
committed by GitHub
parent 2c9ef2f6bb
commit b212fb9a9e
5 changed files with 27 additions and 8 deletions
+7 -5
View File
@@ -15,31 +15,33 @@ var (
atomicPacketsOut uint64
atomicNackTotal uint64
promPacketLabels = []string{"direction"}
promPacketTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: livekitNamespace,
Subsystem: "packet",
Name: "total",
}, promLabels)
}, promPacketLabels)
promPacketBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: livekitNamespace,
Subsystem: "packet",
Name: "bytes",
}, promLabels)
}, promPacketLabels)
promNackTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: livekitNamespace,
Subsystem: "nack",
Name: "total",
}, promLabels)
}, promPacketLabels)
promPliTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: livekitNamespace,
Subsystem: "pli",
Name: "total",
}, promLabels)
}, promPacketLabels)
promFirTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: livekitNamespace,
Subsystem: "fir",
Name: "total",
}, promLabels)
}, promPacketLabels)
)
func initPacketStats() {
+11 -1
View File
@@ -9,15 +9,25 @@ import (
"github.com/pion/rtcp"
"github.com/pion/rtp"
"github.com/pion/transport/packetio"
"github.com/prometheus/client_golang/prometheus"
)
const livekitNamespace = "livekit"
var (
promLabels = []string{"direction"}
PromMessageCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: livekitNamespace,
Subsystem: "node",
Name: "messages",
},
[]string{"type", "status"},
)
)
func init() {
prometheus.MustRegister(PromMessageCounter)
initPacketStats()
initRoomStatsReporter()
}