Skip to content

Conversation

@emate
Copy link
Contributor

@emate emate commented Jan 20, 2026

This PR implements heartbeat reporting from the verifier to the aggregator, establishing a unified observability framework that tracks both the verifier's chain state snapshot and the aggregator's perspective on block heights and adaptive scores.

The verifier now exposes comprehensive heartbeat metrics with verifier_id and chain_selector labels:

metrics published upon heartbeat send

verifier_heartbeats_sent_total - Total successfully sent heartbeats
verifier_heartbeats_failed_total - Total failed heartbeat attempts
verifier_heartbeat_duration_seconds - Request latency histogram
verifier_heartbeat_sent_chain_heads - Block height snapshot sent in request per chain

metrics published based on the aggregator's response
verifier_heartbeat_timestamp - Aggregator's timestamp from response
verifier_heartbeat_chain_heads - Aggregator's reported block height per chain
verifier_heartbeat_score - Adaptive score per chain from aggregator

monitoring Monitoring,
chainStatusManager protocol.ChainStatusManager,
heartbeatClient heartbeatpb.HeartbeatServiceClient,
heartbeatInterval time.Duration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add this to CoordinatorConfig instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for heartbeatInterval, yes, it's better to move it to config, but for the heartbeatClient i don't think it's possible. We want to have a separate client instance that is different from the current aggregator client, to decouple responsibilities. Is that what you mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I meant only the heartbeatInterval

}

// Add block height for this chain if available.
// TODO: change to use latest seen block height instead of finalized when available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's create a ticket for this so we don't forget about it.

hr.logger.Infow("Heartbeat sent successfully",
"verifierId", hr.verifierID,
"aggregatorId", resp.AggregatorId,
"chainCount", len(blockHeightsByChain),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the chainCount useful by itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I've added the verifier_heartbeat_sent_chain_heads metric, it's less important, only for informational purposes -- some middle ground between nothing and including full blockHeightsByChain, but we can remove it if needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my experience just having the count is rarely useful while debugging tbh, doesn't harm but not very benefitial.

lggr logger.Logger,
chainStatusManager protocol.ChainStatusManager,
heartbeatClient heartbeatpb.HeartbeatServiceClient,
allSelectors []protocol.ChainSelector,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for relying on this being injected? the status manager gets you all chains anyways with every call. if it's empty and no heart beat should be created should be checked in coordinator IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, so ChainStatusManager does not have a method to get all chain statuses, so since we already need to pass a list of chainselectors, i think it's better to make the HeartBeat Reporter configurable as well, so that we can explicitly set on which chains we want to send latest heads informations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay, I thought we had an endpoint to return all. that makes sense then.


// Record what we're sending in the request. It will be used for monitoring of the lag.
for chainSelector, blockHeight := range req.ChainDetails.BlockHeightsByChain {
chainMetrics := metrics.With("chain_selector", fmt.Sprintf("%d", chainSelector))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this explode cardinality?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot of chain selectors and the block height is always increasing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's only one metric per chainselector, so cardinality shouldn't be a problem

@emate emate marked this pull request as ready for review January 22, 2026 11:06
@emate emate requested review from a team and skudasov as code owners January 22, 2026 11:06
@emate emate force-pushed the emate/ccip-8200-add-heartbeat-client-to-verifier branch 2 times, most recently from 62baac3 to 7cb3220 Compare January 22, 2026 11:38
@emate emate requested a review from asoliman92 January 22, 2026 11:40
@emate emate force-pushed the emate/ccip-8200-add-heartbeat-client-to-verifier branch from 3238c06 to c960c18 Compare January 26, 2026 12:07
asoliman92
asoliman92 previously approved these changes Jan 26, 2026
@emate emate added this pull request to the merge queue Jan 26, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 26, 2026
* Add heartbeat client & reporter to verifier

* Fix tests

* Add basic unit tests

* Fix linter issues

* Fixes

* Use NoopHeartbeatClient instead of nil

* Pass heartbeat interval setting through coordinator config

* Update .gitignore to include some dashboards

* Add initial dashboards for observing heartbeats

* Add dashboards for heartbeat overview

* fix

* Remove unnecessary dependencies for heartbeat client

* Fix circular dependency

* Fix implementation

* Fix
@emate emate removed this pull request from the merge queue due to a manual request Jan 26, 2026
@github-actions
Copy link

Code coverage report:

Package main emate/ccip-8200-add-heartbeat-client-to-verifier diff
github.com/smartcontractkit/chainlink-ccv/aggregator 48.36% 48.39% +0.03%
github.com/smartcontractkit/chainlink-ccv/cmd 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/committee 100.00% 100.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/common 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/executor 41.85% 41.85% +0.00%
github.com/smartcontractkit/chainlink-ccv/indexer 37.02% 37.00% -0.02%
github.com/smartcontractkit/chainlink-ccv/integration 35.71% 36.43% +0.72%
github.com/smartcontractkit/chainlink-ccv/pkg 100.00% 100.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/pricer 39.76% 39.76% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 63.68% 63.68% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 56.01% 55.57% -0.44%

@emate emate enabled auto-merge January 26, 2026 14:24
@emate emate disabled auto-merge January 26, 2026 14:41
@emate emate requested a review from asoliman92 January 26, 2026 17:29
@emate emate enabled auto-merge January 26, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants