moved prometheus to its own package.

This commit is contained in:
Erik Brakkee 2024-08-17 10:17:47 +02:00
parent 3e0828f1fe
commit 49912e02d0
2 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"git.wamblee.org/converge/pkg/models"
"git.wamblee.org/converge/pkg/server/matchmaker"
"git.wamblee.org/converge/pkg/server/prometheus"
"git.wamblee.org/converge/pkg/support/websocketutil"
"log"
"net"
@ -130,7 +131,7 @@ func main() {
websessions := matchmaker.NewWebSessions(notifications.webNotificationChannel)
// monitoring
prometheusMux := http.NewServeMux()
setupPrometheus(prometheusMux, notifications.prometheusNotificationChannel)
prometheus.SetupPrometheus(prometheusMux, notifications.prometheusNotificationChannel)
go func() {
log.Fatal(http.ListenAndServe(":8001", prometheusMux))
}()

View File

@ -1,4 +1,4 @@
package main
package prometheus
import (
"git.wamblee.org/converge/pkg/models"
@ -179,7 +179,7 @@ func clientActive(client *models.Client) {
Set(float64(time.Now().Sub(client.StartTime).Seconds()))
}
func setupPrometheus(mux *http.ServeMux, notifications chan *models.State) {
func SetupPrometheus(mux *http.ServeMux, notifications chan *models.State) {
// go routine that handles incoming events so we don't need to serialize access in some
// other way.
go func() {