-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize merge tracker and add merge metrics #4350
Conversation
8c9f932
to
a383d7c
Compare
Performance Report✔️ no performance regression detected Full benchmark results
|
@@ -71,10 +71,12 @@ export async function runNodeNotifier(modules: NodeNotifierModules): Promise<voi | |||
// Notifier log lines must be kept at a reasonable max width otherwise it's very hard to read | |||
const tdProgress = chain.eth1.getTDProgress(); | |||
if (tdProgress !== null && !tdProgress.ttdHit) { | |||
tdTimeSeries.addPoint(tdProgress.tdDiffScaled, tdProgress.timestamp); | |||
// TimeSeries accept time in Ms while timestamp is in Sec | |||
tdTimeSeries.addPoint(tdProgress.tdDiffScaled, tdProgress.timestamp * 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or TimeSeries.addPoint can take seconds instead and simplify the consumers since all want sec right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right! we can shift to seconds
@@ -135,7 +135,7 @@ export class Eth1MergeBlockTracker { | |||
return { | |||
ttdHit: false, | |||
tdFactor: this.safeTDFactor, | |||
tdDiffScaled: Number((this.latestEth1Block.totalDifficulty / this.safeTDFactor) as bigint), | |||
tdDiffScaled: Number((tdDiff / this.safeTDFactor) as bigint), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! 🙏
@@ -96,7 +96,7 @@ export class Eth1MergeBlockTracker { | |||
// Set latestBlock stats | |||
metrics.eth1.eth1LatestBlockNumber.set(this.latestEth1Block.number); | |||
metrics.eth1.eth1LatestBlockTD.set(Number(this.latestEth1Block.totalDifficulty / this.safeTDFactor)); | |||
metrics.eth1.eth1LatestBlockTimestamp.set(this.latestEth1Block.timestamp); | |||
metrics.eth1.eth1LatestBlockTimestamp.set(this.latestEth1Block.timestamp * 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prometheus metrics always deal with IS units, so in case of time it must be seconds. See https://prometheus.io/docs/practices/naming/#metric-names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved collection in seconds, and update the dashboard expression (*1000) which displays with unit "From now" which seems to be using ms.
3f377aa
to
c5ea976
Compare
}); | ||
} | ||
// It is possible for status to be updated to merge complete or found or stopped | ||
if (this.status.code != StatusCode.SEARCHING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition doesn't look right, should it be this?
if (this.status.code != StatusCode.SEARCHING) { | |
if (this.status.code === StatusCode.SEARCHING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we want to clear intervals when its not searching, since this codeflow is called by the poll, if merge block has been found, the this.status has been transitioned to either FOUND or MERGE_COMPLETED (triggered from outside this module)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!!
Optimize merge tracker and add merge metrics
Closes #4133
The merge logging,
curated for brevity: (activated post
bellatrix
) (from local testnet testing ttd=50)first merge is tracked in %age, and then fully expanded form
expanded form activates at >99.99% merge complete or at
12 hours
before estimated merge (here in this log 10 seconds is the threshold for testing purposes)Metrics
Pre-merge
(local testnet TTD 50)
Post-merge
(local testnet TTD 50)
Merge search not started
(lodestar syncing, not near bellatrix, geth snap syncing fresh)
Post-merge
(kiln network)
Merge not set
(mainnet)