Documentation ¶
Index ¶
- func NewServer(opts ...grpc.ServerOption) *grpc.Server
- func Run(server *grpc.Server, addresses ...string) func(context.Context) error
- func WithClientTelemetry(opts ...otelgrpc.Option)
- func WithConfigService(configs ...*konf.Config) grpc.ServerOption
- func WithDialOption(opts ...grpc.DialOption)
- func WithLogHandler(handler slog.Handler) grpc.ServerOption
- func WithTelemetry(opts ...otelgrpc.Option) grpc.ServerOption
- type ConfigServiceServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(opts ...grpc.ServerOption) *grpc.Server
NewServer creates a new gRPC server with the given options.
It wraps grpc.NewServer with built-in interceptors, e.g recovery, log buffering, and statsHandler.
func Run ¶
Run wraps start/stop of the gRPC server in a single run function with listening on multiple tcp and unix socket address.
It also resister health and reflection services if the services have not registered.
func WithClientTelemetry ¶
WithClientTelemetry enables trace and metrics instruments on all gRPC clients.
CAUTION: This function may break in new version of `google.golang.org/grpc` since it is using internal package from grpc.
func WithConfigService ¶
func WithConfigService(configs ...*konf.Config) grpc.ServerOption
WithConfigService registers the pb.ConfigServiceServer implement to the gRPC server.
It uses the global konf.Config if the configs are not provided.
func WithDialOption ¶
func WithDialOption(opts ...grpc.DialOption)
WithDialOption adds global dial options for all gRPC clients.
CAUTION: This function may break in new version of `google.golang.org/grpc` since it is using internal package from grpc.
func WithLogHandler ¶
func WithLogHandler(handler slog.Handler) grpc.ServerOption
WithLogHandler provides the slog.Handler for gRPC logs.
If the handler is not provided, it uses handler from slog.Default().
func WithTelemetry ¶
func WithTelemetry(opts ...otelgrpc.Option) grpc.ServerOption
WithTelemetry enables trace and metrics instruments on the gRPC server.
Types ¶
type ConfigServiceServer ¶
type ConfigServiceServer struct { pb.UnimplementedConfigServiceServer // contains filtered or unexported fields }
ConfigServiceServer is an implementation of pb.ConfigServiceServer.
func (ConfigServiceServer) Explain ¶
func (c ConfigServiceServer) Explain(_ context.Context, request *pb.ExplainRequest) (*pb.ExplainResponse, error)