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

Backend Healthcheck #313

Merged

Conversation

Buphido
Copy link
Contributor

@Buphido Buphido commented Sep 9, 2021

Basic healthcheck implemented in file probe.go


Reviewer checklist
  • Read PR description: a summary about the changes is required
  • Changelog updated
  • Documentation: docs/{Reference, Cli, ...}, Docker and cli help/usage
  • Pulled branch, manually tested
  • Verified requirements are met
  • Reviewed the code
  • Reviewed the related tests

Copy link
Collaborator

@malud malud left a 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.

config/runtime/server.go Outdated Show resolved Hide resolved
config/runtime/server.go Outdated Show resolved Hide resolved
config/health_check/health_check.go Show resolved Hide resolved
handler/transport/probe.go Outdated Show resolved Hide resolved
handler/transport/probe_map/probe_map.go Outdated Show resolved Hide resolved
server/http_integration_test.go Outdated Show resolved Hide resolved
server/testdata/integration/endpoint_eval/20_couper.hcl Outdated Show resolved Hide resolved
handler/transport/probe.go Outdated Show resolved Hide resolved
@Buphido Buphido changed the base branch from master to backend-healthchecks October 1, 2021 12:16
handler/transport/backend_options.go Outdated Show resolved Hide resolved
req = req.WithContext(context.WithValue(context.Background(), request.URLAttribute, origin))
return b.evalTransport(req)
}

func (b *Backend) NewProbe() {
Copy link
Collaborator

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))
Copy link
Collaborator

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.

server/http_integration_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@malud malud left a 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.

@malud malud merged commit 28aaee5 into coupergateway:backend-healthchecks Oct 13, 2021
afflerbach added a commit that referenced this pull request Oct 21, 2021
@Buphido Buphido deleted the backend-health-probes branch October 22, 2021 13:42
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