Skip to content

Commit 2023463

Browse files
author
Kate Osborn
committed
Remove return error from NewNginxMetricsCollector
1 parent 716b088 commit 2023463

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

internal/mode/static/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func StartManager(cfg config.Config) error {
158158
if cfg.Plus {
159159
ngxCollector, err = collectors.NewNginxPlusMetricsCollector(constLabels, promLogger)
160160
} else {
161-
ngxCollector, err = collectors.NewNginxMetricsCollector(constLabels, promLogger)
161+
ngxCollector = collectors.NewNginxMetricsCollector(constLabels, promLogger)
162162
}
163163
if err != nil {
164164
return fmt.Errorf("cannot create nginx metrics collector: %w", err)

internal/mode/static/metrics/collectors/nginx.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ const (
2323
)
2424

2525
// NewNginxMetricsCollector creates an NginxCollector which fetches stats from NGINX over a unix socket
26-
func NewNginxMetricsCollector(constLabels map[string]string, logger log.Logger) (prometheus.Collector, error) {
26+
func NewNginxMetricsCollector(constLabels map[string]string, logger log.Logger) prometheus.Collector {
2727
httpClient := getSocketClient(nginxStatusSock)
28-
2928
ngxClient := prometheusClient.NewNginxClient(&httpClient, nginxStatusURI)
3029

31-
return nginxCollector.NewNginxCollector(ngxClient, metrics.Namespace, constLabels, logger), nil
30+
return nginxCollector.NewNginxCollector(ngxClient, metrics.Namespace, constLabels, logger)
3231
}
3332

3433
// NewNginxPlusMetricsCollector creates an NginxCollector which fetches stats from NGINX Plus API over a unix socket

0 commit comments

Comments
 (0)