Documentation
¶
Index ¶
Constants ¶
const ErrDomainMetrics = "metrics"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Meters ¶
type Meters struct {
// contains filtered or unexported fields
}
Meters helps with collecting metrics for prometheus from grpc.
func InitMeters ¶
func (*Meters) StreamInterceptor ¶
func (m *Meters) StreamInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamInterceptor tracks the duration and count of streaming gRPC calls.
func (*Meters) UnaryInterceptor ¶
func (m *Meters) UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
UnaryInterceptor tracks the duration and count of unary gRPC calls.
type Recover ¶
type Recover struct{}
Recover helps in recovering panics grpc endpoints. we could also add a client to notify in the future.
func NewRecover ¶
func NewRecover() *Recover
NewRecover will create a Recover instance. Recover as both Unary and Stream interceptor for server. More information about the interceptors can be found here. https://grpc.io/docs/guides/interceptors
func (*Recover) StreamInterceptor ¶
func (r *Recover) StreamInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
StreamInterceptor intercepts for any panics, and helps our server to recover. Note: It is better to add this as the last interceptor.
func (*Recover) UnaryInterceptor ¶
func (r *Recover) UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ any, err error)
UnaryInterceptor intercepts for any panics, and helps our server to recover. Note: It is better to add this as the last interceptor.