Skip to content

Commit 8f49fff

Browse files
authored
fix monitoring (#462)
1 parent ad7ba95 commit 8f49fff

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

monitoring/cmd/monitoring/main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"context"
54
"fmt"
65

76
"github.com/smartcontractkit/chainlink-common/pkg/logger"
@@ -14,8 +13,6 @@ import (
1413
)
1514

1615
func main() {
17-
ctx := context.Background()
18-
1916
log, err := logger.New()
2017
if err != nil {
2118
log.Fatal(err)
@@ -65,7 +62,7 @@ func main() {
6562
txResultsFactory := monitoring.NewTxResultsSourceFactory(ocr2Client)
6663

6764
monitor, err := monitoring.NewMonitorPrometheusOnly(
68-
ctx,
65+
make(chan struct{}),
6966
logger.With(log, "component", "monitor"),
7067
starknetConfig,
7168
envelopeSourceFactory,

monitoring/pkg/monitoring/monitor.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package monitoring
22

33
import (
4-
"context"
54
"fmt"
65
"net/http"
76
"net/url"
@@ -12,12 +11,13 @@ import (
1211
"github.com/smartcontractkit/chainlink-common/pkg/logger"
1312
commonMonitor "github.com/smartcontractkit/chainlink-common/pkg/monitoring"
1413
"github.com/smartcontractkit/chainlink-common/pkg/monitoring/config"
14+
"github.com/smartcontractkit/chainlink-common/pkg/services"
1515
)
1616

1717
// Builds monitor instance with only the prometheus exporter.
1818
// Does not contain kafka exporter.
1919
func NewMonitorPrometheusOnly(
20-
rootCtx context.Context,
20+
stopCh services.StopRChan,
2121
log commonMonitor.Logger,
2222
chainConfig commonMonitor.ChainConfig,
2323
envelopeSourceFactory commonMonitor.SourceFactory,
@@ -62,7 +62,7 @@ func NewMonitorPrometheusOnly(
6262
)
6363

6464
// Configure HTTP server
65-
httpServer := commonMonitor.NewHTTPServer(rootCtx, cfg.HTTP.Address, logger.With(log, "component", "http-server"))
65+
httpServer := commonMonitor.NewHTTPServer(stopCh, cfg.HTTP.Address, logger.With(log, "component", "http-server"))
6666
httpServer.Handle("/metrics", metrics.HTTPHandler())
6767
httpServer.Handle("/debug", manager.HTTPHandler())
6868
// Required for k8s.
@@ -71,7 +71,7 @@ func NewMonitorPrometheusOnly(
7171
}))
7272

7373
return &commonMonitor.Monitor{
74-
RootContext: rootCtx,
74+
StopCh: stopCh,
7575
ChainConfig: chainConfig,
7676
Config: cfg,
7777
Log: log,

0 commit comments

Comments
 (0)