diff --git a/signal/cmd/run.go b/signal/cmd/run.go index cfc140acb..61f7a32a7 100644 --- a/signal/cmd/run.go +++ b/signal/cmd/run.go @@ -90,7 +90,7 @@ var ( return err } - metricsServer := metrics.NewServer(metricsPort, "") + metricsServer, err := metrics.NewServer(metricsPort, "") if err != nil { return fmt.Errorf("setup metrics: %v", err) } diff --git a/signal/metrics/metrics.go b/signal/metrics/metrics.go index 30db1600a..f411501cb 100644 --- a/signal/metrics/metrics.go +++ b/signal/metrics/metrics.go @@ -26,10 +26,10 @@ type Metrics struct { } // NewServer initializes and returns a new Metrics instance -func NewServer(port int, endpoint string) *Metrics { +func NewServer(port int, endpoint string) (*Metrics, error) { exporter, err := prometheus.New() if err != nil { - return nil + return nil, err } provider := metric.NewMeterProvider(metric.WithReader(exporter)) @@ -57,7 +57,7 @@ func NewServer(port int, endpoint string) *Metrics { provider: provider, Endpoint: endpoint, Server: server, - } + }, nil } // Shutdown stops the metrics server