Documentation ¶
Overview ¶
Package grpc provides opinionated production-ready configured gRPC server.
It includes error recovery, logger integration and optional telemetry instrument with following code sample:
Usage
grpc.NewServer( grpc.WithTelemetry(), )( func(srv *grpc.Server) { // Register your server implementation here. }, )
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ServerOption ¶
type ServerOption func(*serverOptions)
ServerOption configures how we run gRPC server.
func WithAddress ¶
func WithAddress(address string) ServerOption
WithAddress specifies the address listened by gRPC server.
It could be either tcp address like :8080 or unix socket like unix:socket_path.
The default address is :8080.
func WithGRPCOptions ¶ added in v0.5.0
func WithGRPCOptions(opts ...grpc.ServerOption) ServerOption
WithGRPCOptions provides additional grpc.ServerOption for gRPC server.
func WithStopGate ¶
func WithStopGate(gate func()) ServerOption
WithStopGate enables provided gate function blocks the shutdown of the gRPC server until it returns.
func WithTelemetry ¶
func WithTelemetry(opts ...otelgrpc.Option) ServerOption
WithTelemetry enables trace and metric instrument on gRPC Server.
Click to show internal directories.
Click to hide internal directories.