-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
feat: warning log if primary beacon node is unhealthy #6921
Changes from all commits
1427d34
3a87b06
11946cd
4074da3
b42eb4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,21 @@ export class Validator { | |
this.clock.start(this.controller.signal); | ||
this.chainHeaderTracker.start(this.controller.signal); | ||
|
||
// Add notifier to warn user if primary node is unhealthy as there might | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something to consider is a dedicated notifier as we have it in the beacon node, this would allow to emit further information every epoch / slot, for example the statuses of imported validators / active keys, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be nice |
||
// not be any errors in the logs due to fallback nodes handling the requests | ||
const {httpClient} = this.api; | ||
if (httpClient.urlsInits.length > 1) { | ||
const primaryNodeUrl = toSafePrintableUrl(httpClient.urlsInits[0].baseUrl); | ||
|
||
this.clock?.runEveryEpoch(async () => { | ||
// Only emit warning if URL score is 0 to prevent false positives | ||
// if just a single request fails which might happen due to other reasons | ||
if (httpClient.urlsScore[0] === 0) { | ||
this.logger?.warn("Primary beacon node is unhealthy", {url: primaryNodeUrl}); | ||
} | ||
}); | ||
} | ||
|
||
if (metrics) { | ||
this.db.setMetrics(metrics.db); | ||
|
||
|
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.
Alternative to exposing the http client here would be to emit the warning inside the http client itself but that's not ideal either because a) it does not have any context to what it is connected meaning the log message would have to be more generic and b) it's does not have access to the clock, could emit the warning at an arbitrary interval but emitting on validator makes more sense to me.