moved prometheus to its own package.
This commit is contained in:
		
							parent
							
								
									3e0828f1fe
								
							
						
					
					
						commit
						49912e02d0
					
				@ -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))
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
@ -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() {
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user