Skip to content

Commit

Permalink
fix monitoring (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds authored Jun 12, 2024
1 parent ad7ba95 commit 8f49fff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions monitoring/cmd/monitoring/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"fmt"

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

func main() {
ctx := context.Background()

log, err := logger.New()
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions monitoring/pkg/monitoring/monitor.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package monitoring

import (
"context"
"fmt"
"net/http"
"net/url"
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -71,7 +71,7 @@ func NewMonitorPrometheusOnly(
}))

return &commonMonitor.Monitor{
RootContext: rootCtx,
StopCh: stopCh,
ChainConfig: chainConfig,
Config: cfg,
Log: log,
Expand Down

0 comments on commit 8f49fff

Please sign in to comment.