Documentation ¶
Index ¶
Constants ¶
const ( SoftLimit = 5 * time.Second // cancel requests context HardLimit = 10 * time.Second // immediately stop server )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Process ¶
type Process interface { // Name will be logged on start Name() string // Run blocks until application stops Run() error // Shutdown will gracefully shutdown process Shutdown() error }
Process is a simple interface for long running processes
func GRPC ¶
GRPC adapts grpc.Server to the Process interface, accepts port in the ":8080" form. Cancel all requests (unary and stream) context after 5s soft limit, and waits rpcs
func GRPCUI ¶
GRPCUI will create http server that serve front-end for grpc requests to application (analogue swagger)
Read more: https://github.com/fullstorydev/grpcui
func HTTP ¶
HTTP adapts http.Server to the Process interface, accepts port in the ":8080" form.
All requests context will be done after 5s calling shutdown method. hijackedWG is an optional waitgroup to wait for a graceful shutdown of websockets or server-sent events. HTTP server doesn't care about them itself
func Prometheus ¶
Prometheus add prometheus http server, accepts port in the ":8080" form.
It design to used with "github.com/prometheus/client_golang/prometheus/promauto" You can create promauto metrics and this handler will catch them automatically.
You can curl text file with the all metrics on host "addr" and "/" path (e.g. curl localhost:9090)