Documentation ¶
Index ¶
- func ParseMethod(method string) (string, string)
- func StreamAvailable(conf config.TRISAConfig) grpc.StreamServerInterceptor
- func StreamInterceptors(conf config.TRISAConfig) grpc.ServerOption
- func StreamMonitoring() grpc.StreamServerInterceptor
- func StreamRecovery() grpc.StreamServerInterceptor
- func UnaryAvailable(conf config.TRISAConfig) grpc.UnaryServerInterceptor
- func UnaryInterceptors(conf config.TRISAConfig) grpc.ServerOption
- func UnaryMonitoring() grpc.UnaryServerInterceptor
- func UnaryRecovery() grpc.UnaryServerInterceptor
- type MonitoredStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseMethod ¶
func StreamAvailable ¶
func StreamAvailable(conf config.TRISAConfig) grpc.StreamServerInterceptor
func StreamInterceptors ¶
func StreamInterceptors(conf config.TRISAConfig) grpc.ServerOption
Returns the server option chaining all stream interceptors in the specified order.
func StreamMonitoring ¶
func StreamMonitoring() grpc.StreamServerInterceptor
Monitoring handles both logging and outputing Prometheus metrics (if enabled). These are embedded into the same interceptor so that the monitoring uses the same logging, tracing, and latency -- allowing this to be the outermost interceptor. TODO: add prometheus metrics
func StreamRecovery ¶
func StreamRecovery() grpc.StreamServerInterceptor
Panic recovery logs a panic and stack trace without crashing the server, then converts the panic into a gRPC error to return to the client, keeping the server online. The panic is recovered at any point in the stream handler execution.
func UnaryAvailable ¶
func UnaryAvailable(conf config.TRISAConfig) grpc.UnaryServerInterceptor
func UnaryInterceptors ¶
func UnaryInterceptors(conf config.TRISAConfig) grpc.ServerOption
Returns the server option chaining all unary interceptors in the specified order.
func UnaryMonitoring ¶
func UnaryMonitoring() grpc.UnaryServerInterceptor
Monitoring handles both logging and outputing Prometheus metrics (if enabled). These are embedded into the same interceptor so that the monitoring uses the same logging, tracing, and latency -- allowing this to be the outermost interceptor. TODO: add prometheus metrics
func UnaryRecovery ¶
func UnaryRecovery() grpc.UnaryServerInterceptor
Panic recovery logs a panic and stack trace without crashing the server, then converts the panic into a gRPC error to return to the client, keeping the server online.
Types ¶
type MonitoredStream ¶
type MonitoredStream struct { grpc.ServerStream // contains filtered or unexported fields }
MonitoredStream wraps a grpc.ServerStream to count the number of messages sent in the stream for logging purposes. It also provides the stream the adapted context.
func (*MonitoredStream) Context ¶
func (s *MonitoredStream) Context() context.Context
func (*MonitoredStream) RecvMsg ¶
func (s *MonitoredStream) RecvMsg(m interface{}) (err error)
Increment the number of received messages if there is no error on Recv.
func (*MonitoredStream) SendMsg ¶
func (s *MonitoredStream) SendMsg(m interface{}) (err error)
Increment the number of sent messages if there is no error on Send.