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
@ -10,8 +10,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type metrics struct {
|
type metrics struct {
|
||||||
connectionState prometheus.Gauge
|
connectionState prometheus.Gauge
|
||||||
connectionCount prometheus.Counter
|
connectionStateCount prometheus.Counter
|
||||||
|
connectionCount prometheus.Counter
|
||||||
|
|
||||||
iceCandidates map[string]struct{}
|
iceCandidates map[string]struct{}
|
||||||
iceCandidatesCount prometheus.Counter
|
iceCandidatesCount prometheus.Counter
|
||||||
@ -51,6 +52,15 @@ func (m *metricsCtx) getBySession(session types.Session) metrics {
|
|||||||
"session_id": session.ID(),
|
"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{
|
connectionCount: promauto.NewCounter(prometheus.CounterOpts{
|
||||||
Name: "connection_count",
|
Name: "connection_count",
|
||||||
Namespace: "neko",
|
Namespace: "neko",
|
||||||
@ -131,6 +141,8 @@ func (m *metricsCtx) SetState(session types.Session, state webrtc.PeerConnection
|
|||||||
default:
|
default:
|
||||||
met.connectionState.Set(-1)
|
met.connectionState.Set(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
met.connectionStateCount.Add(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *metricsCtx) SetTransportStats(session types.Session, data webrtc.TransportStats) {
|
func (m *metricsCtx) SetTransportStats(session types.Session, data webrtc.TransportStats) {
|
||||||
|
Loading…
Reference in New Issue
Block a user