Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit d507af3

Browse files
bukata-sajmank88lukaszcl
authored
[CCIP-2611] Report new heads to atlas' OTI (#13647) (#1508)
Cherry-pick OTI head report smartcontractkit/chainlink@a41b353 smartcontractkit/chainlink@633eb41 smartcontractkit/chainlink@621e875 smartcontractkit/chainlink@25d2961 --------- Co-authored-by: Jordan Krage <[email protected]> Co-authored-by: Lukasz <[email protected]>
1 parent 463d5e3 commit d507af3

27 files changed

+1309
-463
lines changed

.changeset/eight-bees-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#bugfix head reporter non-zero reporting period

.changeset/hot-laws-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#internal log info on missed finalized head instead of returning an error

.changeset/proud-jokes-exercise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": minor
3+
---
4+
5+
#added Report new heads as a telemetry to OTI

.changeset/swift-pumas-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#internal add head report chain_id

.mockery.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,20 @@ packages:
261261
ORM:
262262
Runner:
263263
PipelineParamUnmarshaler:
264-
github.com/smartcontractkit/chainlink/v2/core/services/promreporter:
264+
github.com/smartcontractkit/chainlink/v2/core/services/headreporter:
265265
config:
266-
dir: core/internal/mocks
266+
dir: "{{ .InterfaceDir }}"
267+
filename: "{{ .InterfaceName | snakecase }}_mock.go"
268+
inpackage: true
269+
mockname: "Mock{{ .InterfaceName | camelcase }}"
267270
interfaces:
271+
HeadReporter:
268272
PrometheusBackend:
273+
github.com/smartcontractkit/libocr/commontypes:
274+
config:
275+
dir: "common/types/mocks"
276+
interfaces:
277+
MonitoringEndpoint:
269278
github.com/smartcontractkit/chainlink/v2/core/services/relay/evm:
270279
interfaces:
271280
BatchCaller:
@@ -300,6 +309,15 @@ packages:
300309
interfaces:
301310
Config:
302311
FeeConfig:
312+
github.com/smartcontractkit/chainlink/v2/core/services/telemetry:
313+
config:
314+
dir: "{{ .InterfaceDir }}"
315+
filename: "{{ .InterfaceName | snakecase }}_mock.go"
316+
inpackage: true
317+
mockname: "Mock{{ .InterfaceName | camelcase }}"
318+
interfaces:
319+
MonitoringEndpointGenerator:
320+
IngressAgent:
303321
github.com/smartcontractkit/chainlink/v2/core/services/webhook:
304322
interfaces:
305323
ExternalInitiatorManager:

common/types/mocks/monitoring_endpoint.go

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/internal/mocks/prometheus_backend.go

Lines changed: 0 additions & 204 deletions
This file was deleted.

core/services/chainlink/application.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
"github.com/smartcontractkit/chainlink/v2/core/services/feeds"
5050
"github.com/smartcontractkit/chainlink/v2/core/services/fluxmonitorv2"
5151
"github.com/smartcontractkit/chainlink/v2/core/services/gateway"
52+
"github.com/smartcontractkit/chainlink/v2/core/services/headreporter"
5253
"github.com/smartcontractkit/chainlink/v2/core/services/job"
5354
"github.com/smartcontractkit/chainlink/v2/core/services/keeper"
5455
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
@@ -60,7 +61,6 @@ import (
6061
externalp2p "github.com/smartcontractkit/chainlink/v2/core/services/p2p/wrapper"
6162
"github.com/smartcontractkit/chainlink/v2/core/services/periodicbackup"
6263
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
63-
"github.com/smartcontractkit/chainlink/v2/core/services/promreporter"
6464
"github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer"
6565
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury"
6666
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
@@ -324,8 +324,6 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
324324

325325
srvcs = append(srvcs, mailMon)
326326
srvcs = append(srvcs, relayerChainInterops.Services()...)
327-
promReporter := promreporter.NewPromReporter(opts.DS, legacyEVMChains, globalLogger)
328-
srvcs = append(srvcs, promReporter)
329327

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

366+
promReporter := headreporter.NewPrometheusReporter(opts.DS, legacyEVMChains)
367+
chainIDs := make([]*big.Int, legacyEVMChains.Len())
368+
for i, chain := range legacyEVMChains.Slice() {
369+
chainIDs[i] = chain.ID()
370+
}
371+
telemReporter := headreporter.NewTelemetryReporter(telemetryManager, globalLogger, chainIDs...)
372+
headReporter := headreporter.NewHeadReporterService(opts.DS, globalLogger, promReporter, telemReporter)
373+
srvcs = append(srvcs, headReporter)
368374
for _, chain := range legacyEVMChains.Slice() {
369-
chain.HeadBroadcaster().Subscribe(promReporter)
375+
chain.HeadBroadcaster().Subscribe(headReporter)
370376
chain.TxManager().RegisterResumeCallback(pipelineRunner.ResumeRun)
371377
}
372378

0 commit comments

Comments
 (0)