-
Notifications
You must be signed in to change notification settings - Fork 63
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 grpc health, deprecate old health #861
Conversation
✅ Deploy Preview for polite-licorice-3db33c ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -129,16 +130,28 @@ func (s *ConnectService) setupServer(svcConf service.Configuration) (net.Listene | |||
|
|||
path, handler := schemaConnectV1.NewServiceHandler(fes, append(svcConf.Options, marshalOpts)...) | |||
mux.Handle(path, handler) | |||
mux.Handle(grpchealth.NewHandler(grpchealth.NewStaticChecker( |
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.
Standard implementation, recommended by buf/conntect.
You can test this locally with grpcurl
(below command assumes you've downloaded the health proto to ~/Downloads
):
grpcurl -import-path '/home/{your-user}/Downloads/' -proto health.proto -plaintext localhost:8013 grpc.health.v1.Health/Check
|
||
s.serverMtx.Lock() | ||
s.server = &http.Server{ | ||
ReadHeaderTimeout: time.Second, | ||
Handler: handler, | ||
Handler: mux, |
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.
The mux
created above was actually unused - instead we just used the one handler originally.
@@ -206,8 +219,10 @@ func (s *ConnectService) startMetricsServer(svcConf service.Configuration) error | |||
s.metricsServer.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |||
switch r.URL.Path { |
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.
In my new implementation, I've used mux
instead of this kind of switch statement.
5374cac
to
8414c80
Compare
Codecov Report
@@ Coverage Diff @@
## main #861 +/- ##
==========================================
- Coverage 72.67% 72.33% -0.35%
==========================================
Files 27 27
Lines 2759 2772 +13
==========================================
Hits 2005 2005
- Misses 667 678 +11
- Partials 87 89 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -11,6 +11,7 @@ import ( | |||
"time" | |||
|
|||
schemaConnectV1 "buf.build/gen/go/open-feature/flagd/bufbuild/connect-go/schema/v1/schemav1connect" | |||
"connectrpc.com/grpchealth" |
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.
this package is a connect-compatible implementation of a gRPC healthcheck.
* adds a standard gRPC health check * moves HTTP health checks off the metrics port, to the app port * deprecates old health checks on metrics port Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
572e216
to
a00ae5a
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.
We might consider adding a test using https://github.com/grpc-ecosystem/grpc-health-probe to check the gRPC probes are correct. Currently, the ZD tests use the HTTP probes.
@@ -29,13 +29,13 @@ spec: | |||
readinessProbe: | |||
httpGet: | |||
path: /readyz | |||
port: 8014 |
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.
please, adapt also the ZD tests manifest to use the new port :)
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.
@thisthat flagd-proxy uses the sync package from core, NOT the flag-evaluation
package. For this reason, the health-checks of flagd-proxy are not impacted by this change (which may or may not be good, since things will be a bit inconsistent.
Problem is, I'm not 100% sure I can add HTTP 1.1 health-check support to the sync package since it doesn't use connect
.
great idea! |
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.
overal looks good 🙌
approving and hope there will be improvements proposed by this comment - #861 (review)
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Closed in favor of #863 |
fixes: #831
closed in favor of: #863