Documentation
¶
Index ¶
- Variables
- func Dial(target string, opts *DialOptions, extra ...grpc.DialOption) (*grpc.ClientConn, error)
- func DialContext(ctx context.Context, target string, opts *DialOptions, ...) (*grpc.ClientConn, error)
- func HTTPStatus(c codes.Code) int
- func HTTPStatusFromError(err error) int
- func SetLogger(logger grpclog.LoggerV2)
- type DialOptions
- type Instrumenter
- type Options
- type Server
- type VErrors
Constants ¶
This section is empty.
Variables ¶
var DefaultInstrumenter = NewInstrumenter("rpc.request")
DefaultInstrumenter instruments via "rpc.request" metric
Functions ¶
func Dial ¶
func Dial(target string, opts *DialOptions, extra ...grpc.DialOption) (*grpc.ClientConn, error)
Dial creates a client connection.
func DialContext ¶
func DialContext(ctx context.Context, target string, opts *DialOptions, extra ...grpc.DialOption) (*grpc.ClientConn, error)
DialContext creates a client connection with specified context.
func HTTPStatus ¶ added in v0.3.0
HTTPStatus returns a http stats from a grpc error code
func HTTPStatusFromError ¶ added in v0.3.0
HTTPStatusFromError returns a http stats from a grpc error code
Types ¶
type DialOptions ¶
type DialOptions struct { // Enables transport security. SkipInsecure bool // Makes Dial non-blocking (Dial won't wait for connection to be up before returning). SkipBlock bool // Unary client interceptors. UnaryInterceptors []grpc.UnaryClientInterceptor // Stream client interceptors. StreamInterceptors []grpc.StreamClientInterceptor }
DialOptions represent dial options.
type Instrumenter ¶
type Instrumenter struct {
// contains filtered or unexported fields
}
Instrumenter instances instrument RPC requests via interceptors.
func NewInstrumenter ¶
func NewInstrumenter(metric string) *Instrumenter
NewInstrumenter inits a new instrumenter with a metric
func (*Instrumenter) StreamServerInterceptor ¶
func (i *Instrumenter) StreamServerInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamServerInterceptor implements an grpc.StreamServerInterceptor
func (*Instrumenter) UnaryServerInterceptor ¶
func (i *Instrumenter) UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
UnaryServerInterceptor implements an grpc.UnaryServerInterceptor
type Options ¶
type Options struct { MaxConcurrentStreams uint32 SkipInstrumentation bool UnaryInterceptors []grpc.UnaryServerInterceptor StreamInterceptors []grpc.StreamServerInterceptor }
Options represent server options
type Server ¶
Server embeds a standard grpc Server with a healthcheck
func (*Server) ListenAndServe ¶
ListenAndServe starts the server (blocking).
type VErrors ¶ added in v0.5.0
type VErrors []*errdetails.BadRequest_FieldViolation
VErrors contains a set of field-violations.
func VErrorsConvert ¶ added in v0.5.0
VErrorsConvert extracts validation errors from an error. This function will return nil if no validation errors are attached.
func VErrorsFromStatus ¶ added in v0.5.0
VErrorsFromStatus extracts validation errors from status.
func (VErrors) InvalidArgument ¶ added in v0.5.0
InvalidArgument returns an InvalidArgument status.