mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
metrics connection State Count.
This commit is contained in:
parent
fc5c017666
commit
7a1c8813e6
@ -11,6 +11,7 @@ import (
|
||||
|
||||
type metrics struct {
|
||||
connectionState prometheus.Gauge
|
||||
connectionStateCount prometheus.Counter
|
||||
connectionCount prometheus.Counter
|
||||
|
||||
iceCandidates map[string]struct{}
|
||||
@ -51,6 +52,15 @@ func (m *metricsCtx) getBySession(session types.Session) metrics {
|
||||
"session_id": session.ID(),
|
||||
},
|
||||
}),
|
||||
connectionStateCount: promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "connection_state_count",
|
||||
Namespace: "neko",
|
||||
Subsystem: "webrtc",
|
||||
Help: "Count of connection state changes for a session.",
|
||||
ConstLabels: map[string]string{
|
||||
"session_id": session.ID(),
|
||||
},
|
||||
}),
|
||||
connectionCount: promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "connection_count",
|
||||
Namespace: "neko",
|
||||
@ -131,6 +141,8 @@ func (m *metricsCtx) SetState(session types.Session, state webrtc.PeerConnection
|
||||
default:
|
||||
met.connectionState.Set(-1)
|
||||
}
|
||||
|
||||
met.connectionStateCount.Add(1)
|
||||
}
|
||||
|
||||
func (m *metricsCtx) SetTransportStats(session types.Session, data webrtc.TransportStats) {
|
||||
|
Loading…
Reference in New Issue
Block a user