Documentation ¶
Index ¶
- func Dial(ctx context.Context, addr string, log *slog.Logger, ...) (*grpc.ClientConn, error)
- func NewClientMetrics(reg *prometheus.Registry, namespace, subsystem string) *grpc_prometheus.ClientMetrics
- func NewConnectServer(m metrics.Metrics, log *slog.Logger, ...) (*grpc.Server, *health.Server)
- func NewLogger(l *slog.Logger) grpclog.LoggerV2
- func NewServer(m metrics.Metrics, log *slog.Logger, ...) (*grpc.Server, *health.Server)
- func NewServerMetrics(reg *prometheus.Registry, namespace, subsystem string) *grpc_prometheus.ServerMetrics
- func StreamConvertCodesServerInterceptor(converter GRPCCodesConverterHandler) grpc.StreamServerInterceptor
- func UnaryConvertCodesServerInterceptor(converter GRPCCodesConverterHandler) grpc.UnaryServerInterceptor
- type GRPCCodesConverterHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(ctx context.Context, addr string, log *slog.Logger, metrics *grpc_prometheus.ClientMetrics, extraUnary []grpc.UnaryClientInterceptor, extraStream []grpc.StreamClientInterceptor, extraDialOption []grpc.DialOption, ) (*grpc.ClientConn, error)
Dial creates a gRPC client connection to the given target.
func NewClientMetrics ¶
func NewClientMetrics(reg *prometheus.Registry, namespace, subsystem string) *grpc_prometheus.ClientMetrics
NewClientMetrics returns gRPC client metrics.
func NewConnectServer ¶
func NewConnectServer( m metrics.Metrics, log *slog.Logger, serverMetrics *grpc_prometheus.ServerMetrics, converter GRPCCodesConverterHandler, extraUnary []grpc.UnaryServerInterceptor, extraStream []grpc.StreamServerInterceptor, ) (*grpc.Server, *health.Server)
NewConnectServer creates and returns a connect server.
func NewServer ¶
func NewServer( m metrics.Metrics, log *slog.Logger, serverMetrics *grpc_prometheus.ServerMetrics, converter GRPCCodesConverterHandler, extraUnary []grpc.UnaryServerInterceptor, extraStream []grpc.StreamServerInterceptor, ) (*grpc.Server, *health.Server)
NewServer creates and returns a gRPC server.
func NewServerMetrics ¶
func NewServerMetrics(reg *prometheus.Registry, namespace, subsystem string) *grpc_prometheus.ServerMetrics
NewServerMetrics returns gRPC server metrics. Do not forget to call .InitializeMetrics(server) on returned value.
func StreamConvertCodesServerInterceptor ¶
func StreamConvertCodesServerInterceptor(converter GRPCCodesConverterHandler) grpc.StreamServerInterceptor
StreamConvertCodesServerInterceptor returns a new unary server interceptor that converting returns error.
func UnaryConvertCodesServerInterceptor ¶
func UnaryConvertCodesServerInterceptor(converter GRPCCodesConverterHandler) grpc.UnaryServerInterceptor
UnaryConvertCodesServerInterceptor returns a new unary server interceptor that converting returns error.
Types ¶
type GRPCCodesConverterHandler ¶
GRPCCodesConverterHandler is a function that convert your error to gRPC codes. The context can be used to extract request scoped metadata and context values.