feat: add middlewares config for zrpc (#2766)
* feat: add middlewares config for zrpc * chore: add tests * chore: improve codecov * chore: improve codecov
This commit is contained in:
@@ -70,7 +70,7 @@ func NewClient(c RpcClientConf, options ...ClientOption) (Client, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client, err := internal.NewClient(target, opts...)
|
||||
client, err := internal.NewClient(target, c.Middlewares, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -82,7 +82,14 @@ func NewClient(c RpcClientConf, options ...ClientOption) (Client, error) {
|
||||
|
||||
// NewClientWithTarget returns a Client with connecting to given target.
|
||||
func NewClientWithTarget(target string, opts ...ClientOption) (Client, error) {
|
||||
return internal.NewClient(target, opts...)
|
||||
middlewares := ClientMiddlewaresConf{
|
||||
Trace: true,
|
||||
Duration: true,
|
||||
Prometheus: true,
|
||||
Breaker: true,
|
||||
Timeout: true,
|
||||
}
|
||||
return internal.NewClient(target, middlewares, opts...)
|
||||
}
|
||||
|
||||
// Conn returns the underlying grpc.ClientConn.
|
||||
|
||||
Reference in New Issue
Block a user