Skip to content

Commit

Permalink
[CCIP-2611] Report new heads to atlas' OTI (#13647) (#1508)
Browse files Browse the repository at this point in the history
  • Loading branch information
3 people authored Oct 23, 2024
1 parent 463d5e3 commit d507af3
Show file tree
Hide file tree
Showing 27 changed files with 1,309 additions and 463 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-bees-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#bugfix head reporter non-zero reporting period
5 changes: 5 additions & 0 deletions .changeset/hot-laws-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal log info on missed finalized head instead of returning an error
5 changes: 5 additions & 0 deletions .changeset/proud-jokes-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#added Report new heads as a telemetry to OTI
5 changes: 5 additions & 0 deletions .changeset/swift-pumas-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal add head report chain_id
22 changes: 20 additions & 2 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,20 @@ packages:
ORM:
Runner:
PipelineParamUnmarshaler:
github.com/smartcontractkit/chainlink/v2/core/services/promreporter:
github.com/smartcontractkit/chainlink/v2/core/services/headreporter:
config:
dir: core/internal/mocks
dir: "{{ .InterfaceDir }}"
filename: "{{ .InterfaceName | snakecase }}_mock.go"
inpackage: true
mockname: "Mock{{ .InterfaceName | camelcase }}"
interfaces:
HeadReporter:
PrometheusBackend:
github.com/smartcontractkit/libocr/commontypes:
config:
dir: "common/types/mocks"
interfaces:
MonitoringEndpoint:
github.com/smartcontractkit/chainlink/v2/core/services/relay/evm:
interfaces:
BatchCaller:
Expand Down Expand Up @@ -300,6 +309,15 @@ packages:
interfaces:
Config:
FeeConfig:
github.com/smartcontractkit/chainlink/v2/core/services/telemetry:
config:
dir: "{{ .InterfaceDir }}"
filename: "{{ .InterfaceName | snakecase }}_mock.go"
inpackage: true
mockname: "Mock{{ .InterfaceName | camelcase }}"
interfaces:
MonitoringEndpointGenerator:
IngressAgent:
github.com/smartcontractkit/chainlink/v2/core/services/webhook:
interfaces:
ExternalInitiatorManager:
Expand Down
65 changes: 65 additions & 0 deletions common/types/mocks/monitoring_endpoint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

204 changes: 0 additions & 204 deletions core/internal/mocks/prometheus_backend.go

This file was deleted.

14 changes: 10 additions & 4 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/feeds"
"github.com/smartcontractkit/chainlink/v2/core/services/fluxmonitorv2"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway"
"github.com/smartcontractkit/chainlink/v2/core/services/headreporter"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/keeper"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
Expand All @@ -60,7 +61,6 @@ import (
externalp2p "github.com/smartcontractkit/chainlink/v2/core/services/p2p/wrapper"
"github.com/smartcontractkit/chainlink/v2/core/services/periodicbackup"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
"github.com/smartcontractkit/chainlink/v2/core/services/promreporter"
"github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
Expand Down Expand Up @@ -324,8 +324,6 @@ func NewApplication(opts ApplicationOpts) (Application, error) {

srvcs = append(srvcs, mailMon)
srvcs = append(srvcs, relayerChainInterops.Services()...)
promReporter := promreporter.NewPromReporter(opts.DS, legacyEVMChains, globalLogger)
srvcs = append(srvcs, promReporter)

// Initialize Local Users ORM and Authentication Provider specified in config
// BasicAdminUsersORM is initialized and required regardless of separate Authentication Provider
Expand Down Expand Up @@ -365,8 +363,16 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
workflowORM = workflowstore.NewDBStore(opts.DS, globalLogger, clockwork.NewRealClock())
)

promReporter := headreporter.NewPrometheusReporter(opts.DS, legacyEVMChains)
chainIDs := make([]*big.Int, legacyEVMChains.Len())
for i, chain := range legacyEVMChains.Slice() {
chainIDs[i] = chain.ID()
}
telemReporter := headreporter.NewTelemetryReporter(telemetryManager, globalLogger, chainIDs...)
headReporter := headreporter.NewHeadReporterService(opts.DS, globalLogger, promReporter, telemReporter)
srvcs = append(srvcs, headReporter)
for _, chain := range legacyEVMChains.Slice() {
chain.HeadBroadcaster().Subscribe(promReporter)
chain.HeadBroadcaster().Subscribe(headReporter)
chain.TxManager().RegisterResumeCallback(pipelineRunner.ResumeRun)
}

Expand Down
Loading

0 comments on commit d507af3

Please sign in to comment.