Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/connectrpc/grpchealth-go
gRPC-compatible health checks for any net/http server.
https://github.com/connectrpc/grpchealth-go
connectrpc go grpc protobuf rpc
Last synced: about 1 month ago
JSON representation
gRPC-compatible health checks for any net/http server.
- Host: GitHub
- URL: https://github.com/connectrpc/grpchealth-go
- Owner: connectrpc
- License: apache-2.0
- Created: 2022-03-21T19:02:15.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-23T14:00:39.000Z (6 months ago)
- Last Synced: 2024-12-09T03:54:41.477Z (2 months ago)
- Topics: connectrpc, go, grpc, protobuf, rpc
- Language: Go
- Homepage: https://connectrpc.com
- Size: 95.7 KB
- Stars: 67
- Watchers: 12
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
grpchealth
==========[![Build](https://github.com/connectrpc/grpchealth-go/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/connectrpc/grpchealth-go/actions/workflows/ci.yaml)
[![Report Card](https://goreportcard.com/badge/connectrpc.com/grpchealth)](https://goreportcard.com/report/connectrpc.com/grpchealth)
[![GoDoc](https://pkg.go.dev/badge/connectrpc.com/grpchealth.svg)](https://pkg.go.dev/connectrpc.com/grpchealth)`connectrpc.com/grpchealth` adds support for gRPC-style health checks to any
`net/http` server — including those built with [Connect][connect]. By
polling this API, load balancers, container orchestrators, and other
infrastructure systems can respond to changes in your HTTP server's health.The exposed health checking API is wire compatible with Google's gRPC
implementations, so it works with [grpcurl], [grpc-health-probe], and
[Kubernetes gRPC liveness probes][k8s-liveness].For more on Connect, see the [announcement blog post][blog], the documentation
on [connectrpc.com][docs] (especially the [Getting Started] guide for Go), the
[Connect][connect] repo, or the [demo service][examples-go].## Example
```go
package mainimport (
"net/http""golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
"connectrpc.com/grpchealth"
)func main() {
mux := http.NewServeMux()
checker := grpchealth.NewStaticChecker(
"acme.user.v1.UserService",
"acme.group.v1.GroupService",
// protoc-gen-connect-go generates package-level constants
// for these fully-qualified protobuf service names, so you'd more likely
// reference userv1.UserServiceName and groupv1.GroupServiceName.
)
mux.Handle(grpchealth.NewHandler(checker))
// If you don't need to support HTTP/2 without TLS (h2c), you can drop
// x/net/http2 and use http.ListenAndServeTLS instead.
http.ListenAndServe(
":8080",
h2c.NewHandler(mux, &http2.Server{}),
)
}
```## Status: Stable
This module is stable. It supports:
* The three most recent major releases of Go. Keep in mind that [only the last
two releases receive security patches][go-support-policy].
* [APIv2] of Protocol Buffers in Go (`google.golang.org/protobuf`).Within those parameters, `grpchealth` follows semantic versioning.
We will _not_ make breaking changes in the 1.x series of releases.## Legal
Offered under the [Apache 2 license][license].
[APIv2]: https://blog.golang.org/protobuf-apiv2
[Getting Started]: https://connectrpc.com/go/getting-started
[blog]: https://buf.build/blog/connect-a-better-grpc
[connect]: https://github.com/connectrpc/connect-go
[examples-go]: https://github.com/connectrpc/examples-go
[docs]: https://connectrpc.com
[go-support-policy]: https://golang.org/doc/devel/release#policy
[grpc-health-probe]: https://github.com/grpc-ecosystem/grpc-health-probe/
[grpcurl]: https://github.com/fullstorydev/grpcurl
[k8s-liveness]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-grpc-liveness-probe
[license]: https://github.com/connectrpc/grpchealth-go/blob/main/LICENSE.txt