diff --git a/config.go b/config.go index 911d57cddf7e6199c933b6b538674858a10e9abb..bd4326cb1eb35fd7bc0c8bd06977ec9af91fb630 100644 --- a/config.go +++ b/config.go @@ -8,9 +8,9 @@ import ( // Config holds the application configuration type Config struct { - LibvirtURI string - ListenAddr string - MetricsPath string + LibvirtURI string + ListenAddr string + MetricsPath string } // ParseConfig parses command line flags and returns the configuration @@ -50,4 +50,4 @@ func (c *Config) Log() { log.Printf("Libvirt URI: %s", c.LibvirtURI) log.Printf("Listening on: %s", c.ListenAddr) log.Printf("Metrics path: %s", c.MetricsPath) -} \ No newline at end of file +} diff --git a/server.go b/server.go index 64366016e96fabe64016155757cc758e1ce794c7..7e5afa27406f03d9bbbad7e65b4bee191c94f0c3 100644 --- a/server.go +++ b/server.go @@ -28,7 +28,7 @@ func (s *Server) SetupHandlers() { // Create a custom registry and register only our collector registry := prometheus.NewRegistry() registry.MustRegister(s.collector) - + // Metrics endpoint using custom registry http.Handle(s.config.MetricsPath, promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) @@ -58,4 +58,4 @@ func (s *Server) Start() error { return fmt.Errorf("failed to start HTTP server: %w", err) } return nil -} \ No newline at end of file +} diff --git a/signal.go b/signal.go index 110cb79c8a578e6cd2622606fe811171e2e6c702..7430d1e1b5067ab3fdd6a27c76e45edaa7d93857 100644 --- a/signal.go +++ b/signal.go @@ -39,4 +39,4 @@ func (s *SignalHandler) shutdown() { s.collector.Close() } log.Println("Shutdown complete") -} \ No newline at end of file +}