Fix prometheus viewer count value & rename metrics names

This commit is contained in:
Gabe Kangas
2022-03-09 17:48:53 -08:00
parent a3e2a1bb1a
commit 994145b609
2 changed files with 9 additions and 10 deletions

View File

@@ -23,10 +23,10 @@ func startViewerCollectionMetrics() {
defer storage.Close()
collectViewerCount()
handlePolling()
for range time.Tick(viewerMetricsPollingInterval) {
collectViewerCount()
collectChatClientCount()
}
}
@@ -35,15 +35,15 @@ func collectViewerCount() {
if !core.GetStatus().Online {
return
}
// Save to our Prometheus collector.
activeViewerCount.Set(float64(core.GetStatus().ViewerCount))
}
func collectChatClientCount() {
count := len(chat.GetClients())
activeChatClientCount.Set(float64(count))
// Save to our Prometheus collector.
activeViewerCount.Set(float64(count))
// Total message count
cmc := data.GetMessagesCount()
currentChatMessageCount.Set(float64(cmc))