-
Notifications
You must be signed in to change notification settings - Fork 15
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
Backend Healthcheck #313
Backend Healthcheck #313
Conversation
eb2352e
to
8de8da6
Compare
d172da0
to
ea1b6f1
Compare
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.
Some structural changes has to be made along with some perf improvement.
handler/transport/probe.go
Outdated
req = req.WithContext(context.WithValue(context.Background(), request.URLAttribute, origin)) | ||
return b.evalTransport(req) | ||
} | ||
|
||
func (b *Backend) NewProbe() { |
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.
Just NewProbe() *Probe
and assign the result within NewBackend().
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(p.timeOut)) | ||
res, err := http.DefaultClient.Do(req.WithContext(ctx)) | ||
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(p.Opts.Timeout)) | ||
res, err := http.DefaultClient.Do(p.Req.WithContext(ctx)) |
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.
Maybe you could make use of the logger (given to the backend) to at least debug log those request errors.
Putting the log next to your current //print...
:90 you could also provide the current state.
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.
Thanks for your contribution @Buphido .
We finally have specified namings and behaviour and will adapt those things on top of your code.
Basic healthcheck implemented in file probe.go
Reviewer checklist