From 234b75c5d4ba3800590f60ded8bd750cbf5f7b61 Mon Sep 17 00:00:00 2001 From: wangqing Date: Fri, 10 Oct 2025 16:59:39 +0800 Subject: [PATCH] =?UTF-8?q?fmt:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangqing --- config.go | 8 ++++---- server.go | 4 ++-- signal.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.go b/config.go index 911d57c..bd4326c 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 6436601..7e5afa2 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 110cb79..7430d1e 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 +} -- Gitee