Skip to content
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

core/services: health Checker cleanup #10670

Merged
merged 2 commits into from
Sep 18, 2023
Merged

Conversation

jmank88
Copy link
Contributor

@jmank88 jmank88 commented Sep 17, 2023

I noticed some services were added to the health checker twice, and then found some simplifications while cleaning it up.

@github-actions
Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

Comment on lines -484 to -493
// To avoid subscribing chain services twice, we only subscribe them if OCR2 is not enabled.
// If it's enabled, they are going to be registered with relayers by default.
if !cfg.OCR2().Enabled() {
for _, service := range app.relayers.Services() {
checkable := service.(services.Checkable)
if err := app.HealthChecker.Register(service.Name(), checkable); err != nil {
return nil, err
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This exception is no longer required since the relayer services are now added unconditionally.

Comment on lines +444 to +446
healthChecker := services.NewChecker()
for _, s := range srvcs {
if err := healthChecker.Register(s); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Relocated and simplified - no need to cast.

@@ -176,7 +176,8 @@ func (c *checker) update() {
uptimeSeconds.Add(interval.Seconds())
}

func (c *checker) Register(name string, service Checkable) error {
func (c *checker) Register(service Checkable) error {
Copy link
Contributor Author

@jmank88 jmank88 Sep 17, 2023

Choose a reason for hiding this comment

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

Outside of tests, we only check ServiceCtxs, so every Checkable implementation already had a Name() method. Now that method is defined on Checkable instead of ServiceCtx.

@jmank88 jmank88 force-pushed the health-check-cleanup branch from 86104ca to 9f2e0dd Compare September 17, 2023 12:09
plugins/server.go Outdated Show resolved Hide resolved
@jmank88 jmank88 force-pushed the health-check-cleanup branch from 0005629 to ce4b6c7 Compare September 18, 2023 13:56
@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate failed

Failed condition 72.7% 72.7% Coverage on New Code (is less than 80%)
Failed condition 7.7% 7.69% Duplicated Lines (%) on New Code (is greater than 3%)

See analysis details on SonarQube

@jmank88 jmank88 added this pull request to the merge queue Sep 18, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 18, 2023
@krehermann krehermann added this pull request to the merge queue Sep 18, 2023
Merged via the queue into develop with commit d4e9b28 Sep 18, 2023
@krehermann krehermann deleted the health-check-cleanup branch September 18, 2023 20:30
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.

3 participants