Fix client count metric

This commit is contained in:
Torjus Håkestad 2021-11-01 21:57:13 +01:00
parent 0e792d2416
commit 849d8e0011
2 changed files with 3 additions and 3 deletions

View File

@ -346,12 +346,11 @@ func (rs *RTMPServer) EnableMetrics() {
}, },
) )
prometheus.MustRegister(currentStreams) prometheus.MustRegister(currentStreams)
currentClients := prometheus.NewGaugeVec( currentClients := prometheus.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "dogtamer_current_clients", Name: "dogtamer_current_clients",
Help: "Currently connected clients.", Help: "Currently connected clients.",
}, },
[]string{"stream_name"},
) )
prometheus.MustRegister(currentClients) prometheus.MustRegister(currentClients)
bytesReceived := prometheus.NewGaugeVec( bytesReceived := prometheus.NewGaugeVec(
@ -402,6 +401,7 @@ func (rs *RTMPServer) EnableMetrics() {
} }
} }
rs.streamsLock.RUnlock() rs.streamsLock.RUnlock()
currentClients.Set(float64(clientCount))
} }
}() }()
} }

View File

@ -2,7 +2,7 @@ package dogtamer
import "fmt" import "fmt"
const Version string = "v0.1.9" const Version string = "v0.1.10"
var Build string var Build string