From 8f49fffb8171c4dde3dd0c8501e4a3ce28b2d17a Mon Sep 17 00:00:00 2001 From: Augustus <14297860+augustbleeds@users.noreply.github.com> Date: Wed, 12 Jun 2024 09:58:32 -0400 Subject: [PATCH] fix monitoring (#462) --- monitoring/cmd/monitoring/main.go | 5 +---- monitoring/pkg/monitoring/monitor.go | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/monitoring/cmd/monitoring/main.go b/monitoring/cmd/monitoring/main.go index 1a4fbd8ad..a94d8b7db 100644 --- a/monitoring/cmd/monitoring/main.go +++ b/monitoring/cmd/monitoring/main.go @@ -1,7 +1,6 @@ package main import ( - "context" "fmt" "github.com/smartcontractkit/chainlink-common/pkg/logger" @@ -14,8 +13,6 @@ import ( ) func main() { - ctx := context.Background() - log, err := logger.New() if err != nil { log.Fatal(err) @@ -65,7 +62,7 @@ func main() { txResultsFactory := monitoring.NewTxResultsSourceFactory(ocr2Client) monitor, err := monitoring.NewMonitorPrometheusOnly( - ctx, + make(chan struct{}), logger.With(log, "component", "monitor"), starknetConfig, envelopeSourceFactory, diff --git a/monitoring/pkg/monitoring/monitor.go b/monitoring/pkg/monitoring/monitor.go index b1c6d0c03..8dbbbf6a7 100644 --- a/monitoring/pkg/monitoring/monitor.go +++ b/monitoring/pkg/monitoring/monitor.go @@ -1,7 +1,6 @@ package monitoring import ( - "context" "fmt" "net/http" "net/url" @@ -12,12 +11,13 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" commonMonitor "github.com/smartcontractkit/chainlink-common/pkg/monitoring" "github.com/smartcontractkit/chainlink-common/pkg/monitoring/config" + "github.com/smartcontractkit/chainlink-common/pkg/services" ) // Builds monitor instance with only the prometheus exporter. // Does not contain kafka exporter. func NewMonitorPrometheusOnly( - rootCtx context.Context, + stopCh services.StopRChan, log commonMonitor.Logger, chainConfig commonMonitor.ChainConfig, envelopeSourceFactory commonMonitor.SourceFactory, @@ -62,7 +62,7 @@ func NewMonitorPrometheusOnly( ) // Configure HTTP server - httpServer := commonMonitor.NewHTTPServer(rootCtx, cfg.HTTP.Address, logger.With(log, "component", "http-server")) + httpServer := commonMonitor.NewHTTPServer(stopCh, cfg.HTTP.Address, logger.With(log, "component", "http-server")) httpServer.Handle("/metrics", metrics.HTTPHandler()) httpServer.Handle("/debug", manager.HTTPHandler()) // Required for k8s. @@ -71,7 +71,7 @@ func NewMonitorPrometheusOnly( })) return &commonMonitor.Monitor{ - RootContext: rootCtx, + StopCh: stopCh, ChainConfig: chainConfig, Config: cfg, Log: log,