mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-21 15:43:12 +01:00
Fix error handling (#2316)
This commit is contained in:
parent
268e801ec5
commit
63aeeb834d
@ -90,7 +90,7 @@ var (
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
metricsServer := metrics.NewServer(metricsPort, "")
|
metricsServer, err := metrics.NewServer(metricsPort, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("setup metrics: %v", err)
|
return fmt.Errorf("setup metrics: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ type Metrics struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewServer initializes and returns a new Metrics instance
|
// 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()
|
exporter, err := prometheus.New()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
provider := metric.NewMeterProvider(metric.WithReader(exporter))
|
provider := metric.NewMeterProvider(metric.WithReader(exporter))
|
||||||
@ -57,7 +57,7 @@ func NewServer(port int, endpoint string) *Metrics {
|
|||||||
provider: provider,
|
provider: provider,
|
||||||
Endpoint: endpoint,
|
Endpoint: endpoint,
|
||||||
Server: server,
|
Server: server,
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown stops the metrics server
|
// Shutdown stops the metrics server
|
||||||
|
Loading…
Reference in New Issue
Block a user