Documentation ¶
Overview ¶
Package server provides an opinionated http server.
Package server provides an opinionated http server.
Although exported, this package is non intended for general consumption. It is a shared dependency between multiple exposure notifications projects. We cannot guarantee that there won't be breaking changes in the future.
Index ¶
- func HandleHealthz(hctx context.Context) http.Handler
- func ServeMetricsIfPrometheus(ctx context.Context) error
- type Server
- func (s *Server) Addr() string
- func (s *Server) IP() string
- func (s *Server) Port() string
- func (s *Server) ServeGRPC(ctx context.Context, srv *grpc.Server) error
- func (s *Server) ServeHTTP(ctx context.Context, srv *http.Server) error
- func (s *Server) ServeHTTPHandler(ctx context.Context, handler http.Handler) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeMetricsIfPrometheus ¶
ServeMetricsIfPrometheus serves the opencensus metrics at /metrics when OBSERVABILITY_EXPORTER set to "prometheus"
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides a gracefully-stoppable http server implementation. It is safe for concurrent use in goroutines.
func New ¶
New creates a new server listening on the provided address that responds to the http.Handler. It starts the listener, but does not start the server. If an empty port is given, the server randomly chooses one.
func (*Server) ServeGRPC ¶
ServeGRPC starts the server and blocks until the provided context is closed. When the provided context is closed, the server is gracefully stopped with a timeout of 5 seconds.
Once a server has been stopped, it is NOT safe for reuse.