From 7be17ee37e430947252a47e0ebdbf9e49491eb88 Mon Sep 17 00:00:00 2001 From: miledxz Date: Wed, 21 Aug 2024 21:29:51 +0200 Subject: [PATCH] experimental fix --- internal/mode/static/manager.go | 3 +-- internal/mode/static/metrics/collectors/nginx.go | 3 +-- internal/mode/static/nginx/runtime/manager.go | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/mode/static/manager.go b/internal/mode/static/manager.go index 72fbd651bb..0b277ca056 100644 --- a/internal/mode/static/manager.go +++ b/internal/mode/static/manager.go @@ -8,7 +8,6 @@ import ( "time" "github.com/go-logr/logr" - ngxclient "github.com/nginxinc/nginx-plus-go-client/client" tel "github.com/nginxinc/telemetry-exporter/pkg/telemetry" "github.com/prometheus/client_golang/prometheus" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" @@ -159,7 +158,7 @@ func StartManager(cfg config.Config) error { handlerCollector handlerMetricsCollector = collectors.NewControllerNoopCollector() ) - var ngxPlusClient *ngxclient.NginxClient + var ngxPlusClient ngxruntime.NginxPlusClient var usageSecret *usage.Secret if cfg.Plus { diff --git a/internal/mode/static/metrics/collectors/nginx.go b/internal/mode/static/metrics/collectors/nginx.go index 28cbc635d3..09400a5230 100644 --- a/internal/mode/static/metrics/collectors/nginx.go +++ b/internal/mode/static/metrics/collectors/nginx.go @@ -2,7 +2,6 @@ package collectors import ( "github.com/go-kit/log" - "github.com/nginxinc/nginx-plus-go-client/client" prometheusClient "github.com/nginxinc/nginx-prometheus-exporter/client" nginxCollector "github.com/nginxinc/nginx-prometheus-exporter/collector" "github.com/prometheus/client_golang/prometheus" @@ -26,7 +25,7 @@ func NewNginxMetricsCollector(constLabels map[string]string, logger log.Logger) // NewNginxPlusMetricsCollector creates an NginxCollector which fetches stats from NGINX Plus API over a unix socket. func NewNginxPlusMetricsCollector( - plusClient *client.NginxClient, + plusClient runtime.NginxPlusClient, constLabels map[string]string, logger log.Logger, ) (prometheus.Collector, error) { diff --git a/internal/mode/static/nginx/runtime/manager.go b/internal/mode/static/nginx/runtime/manager.go index 0d111e0eb3..a5c26a7765 100644 --- a/internal/mode/static/nginx/runtime/manager.go +++ b/internal/mode/static/nginx/runtime/manager.go @@ -36,7 +36,7 @@ var childProcPathFmt = "/proc/%[1]v/task/%[1]v/children" //counterfeiter:generate . nginxPlusClient -type nginxPlusClient interface { +type NginxPlusClient interface { UpdateHTTPServers( upstream string, servers []ngxclient.UpstreamServer, @@ -79,13 +79,13 @@ type ManagerImpl struct { processHandler ProcessHandler metricsCollector MetricsCollector verifyClient nginxConfigVerifier - ngxPlusClient nginxPlusClient + ngxPlusClient NginxPlusClient logger logr.Logger } // NewManagerImpl creates a new ManagerImpl. func NewManagerImpl( - ngxPlusClient nginxPlusClient, + ngxPlusClient NginxPlusClient, collector MetricsCollector, logger logr.Logger, processHandler ProcessHandler,