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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: add health checks #259

wants to merge 3 commits into from

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?

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.

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