moved prometheus to its own package.
This commit is contained in:
parent
7ab213c34e
commit
a12416cd21
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"git.wamblee.org/converge/pkg/models"
|
"git.wamblee.org/converge/pkg/models"
|
||||||
"git.wamblee.org/converge/pkg/server/matchmaker"
|
"git.wamblee.org/converge/pkg/server/matchmaker"
|
||||||
|
"git.wamblee.org/converge/pkg/server/prometheus"
|
||||||
"git.wamblee.org/converge/pkg/support/websocketutil"
|
"git.wamblee.org/converge/pkg/support/websocketutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
@ -130,7 +131,7 @@ func main() {
|
|||||||
websessions := matchmaker.NewWebSessions(notifications.webNotificationChannel)
|
websessions := matchmaker.NewWebSessions(notifications.webNotificationChannel)
|
||||||
// monitoring
|
// monitoring
|
||||||
prometheusMux := http.NewServeMux()
|
prometheusMux := http.NewServeMux()
|
||||||
setupPrometheus(prometheusMux, notifications.prometheusNotificationChannel)
|
prometheus.SetupPrometheus(prometheusMux, notifications.prometheusNotificationChannel)
|
||||||
go func() {
|
go func() {
|
||||||
log.Fatal(http.ListenAndServe(":8001", prometheusMux))
|
log.Fatal(http.ListenAndServe(":8001", prometheusMux))
|
||||||
}()
|
}()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package prometheus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.wamblee.org/converge/pkg/models"
|
"git.wamblee.org/converge/pkg/models"
|
||||||
@ -179,7 +179,7 @@ func clientActive(client *models.Client) {
|
|||||||
Set(float64(time.Now().Sub(client.StartTime).Seconds()))
|
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
|
// go routine that handles incoming events so we don't need to serialize access in some
|
||||||
// other way.
|
// other way.
|
||||||
go func() {
|
go func() {
|
Loading…
Reference in New Issue
Block a user