Documentation ¶
Index ¶
- Constants
- Variables
- func ForceTimeout(ctx context.Context, timeout time.Duration) context.Context
- func GrpcHeaderCarrierInterceptor() grpc.UnaryClientInterceptor
- func LoggerUnaryClientInterceptor(config *LogConf) grpc.UnaryClientInterceptor
- func MetricUnaryClientInterceptor(successCodes []string) grpc.UnaryClientInterceptor
- func TimeoutInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor
- type CallOption
- type LogConf
Constants ¶
View Source
const PkgName = "grpc_client"
Variables ¶
View Source
var ( // ClientHandleCounter ... ClientHandleCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "grpc_client_handle_total", }, []string{"type", "name", "method", "peer", "code"}) // ClientHandleHistogram ... ClientHandleHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "grpc_client_handle_seconds", }, []string{"type", "name", "method", "peer"}) )
View Source
var ( ClientWithBizHandledCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "monitor_grpc_client_accept_result_total", Help: "Total number of RPCs accept on the client, regardless of success or failure.", }, []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code", "result_code"}) )
Functions ¶
func ForceTimeout ¶
ForceTimeout force set timeout for this rpc call Deprecated: use WithForceTimeout
func GrpcHeaderCarrierInterceptor ¶
func GrpcHeaderCarrierInterceptor() grpc.UnaryClientInterceptor
GrpcHeaderCarrierInterceptor
func LoggerUnaryClientInterceptor ¶
func LoggerUnaryClientInterceptor(config *LogConf) grpc.UnaryClientInterceptor
loggerUnaryClientInterceptor returns log interceptor for logging
func MetricUnaryClientInterceptor ¶
func MetricUnaryClientInterceptor(successCodes []string) grpc.UnaryClientInterceptor
func TimeoutInterceptor ¶
func TimeoutInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor
TimeoutInterceptor is an interceptor that controls timeout.
Types ¶
type CallOption ¶
type CallOption struct { grpc.EmptyCallOption // contains filtered or unexported fields }
CallOption is a grpc.CallOption that is local to timeout interceptor.
func WithForceTimeout ¶
func WithForceTimeout(forceTimeout time.Duration) CallOption
WithForceTimeout sets the RPC timeout for this call only.
Click to show internal directories.
Click to hide internal directories.