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

feat: add health checks #259

Merged
merged 4 commits into from
Dec 20, 2024
Merged

feat: add health checks #259

merged 4 commits into from
Dec 20, 2024

Conversation

bpeng
Copy link
Contributor

@bpeng bpeng commented Dec 4, 2024

Ticket https://github.com/GeoNet/tickets/issues/13878

Add health check for services

@bpeng bpeng requested a review from junghao December 5, 2024 20:47
log.Fatalf("error checking queueURL %s: %s", queueURL, err.Error())
}

s3c, err := s3.NewWithMaxRetries(3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove the pointer at L45, and getting rid of the s3c here? Thanks

ping:
for {
err = db.Ping()
if err != nil {
log.Println("problem pinging DB sleeping and retrying")
health.Ok() //send heartbeat
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary. If the service stuck during initial DB connection then it's unhealthy

ping:
for {
err = db.Ping()
if err != nil {
log.Println("problem pinging DB sleeping and retrying")
health.Ok() //send heartbeat
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as fdsn-holdings-consumer

ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

msg, err := health.Check(ctx, ":8080/soh", timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we define ":8080" as a const, then both here and L88 uses that const?

junghao
junghao previously approved these changes Dec 18, 2024
Copy link
Contributor

@junghao junghao left a comment

Choose a reason for hiding this comment

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

Looks good.

@sue-h-gns sue-h-gns merged commit 9a8b94d into main Dec 20, 2024
11 checks passed
@sue-h-gns sue-h-gns deleted the health-check branch December 20, 2024 00:03
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