Documentation
¶
Index ¶
- func Instrument(requestDuration *prometheus.HistogramVec, ...) ([]grpc.UnaryClientInterceptor, []grpc.StreamClientInterceptor)
- func NewRateLimitRetrier(cfg backoff.Config) grpc.UnaryClientInterceptor
- func NewRateLimiter(cfg *Config) grpc.UnaryClientInterceptor
- type Config
- func (cfg *Config) CallOptions() []grpc.CallOption
- func (cfg *Config) DialOption(unaryClientInterceptors []grpc.UnaryClientInterceptor, ...) ([]grpc.DialOption, error)
- func (cfg *Config) RegisterFlags(f *flag.FlagSet)
- func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)
- func (cfg *Config) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Instrument ¶
func Instrument(requestDuration *prometheus.HistogramVec, instrumentationLabelOptions ...middleware.InstrumentationOption) ([]grpc.UnaryClientInterceptor, []grpc.StreamClientInterceptor)
func NewRateLimitRetrier ¶
func NewRateLimitRetrier(cfg backoff.Config) grpc.UnaryClientInterceptor
NewRateLimitRetrier creates a UnaryClientInterceptor which retries with backoff the calls from invoker when the executed RPC is rate limited.
func NewRateLimiter ¶
func NewRateLimiter(cfg *Config) grpc.UnaryClientInterceptor
NewRateLimiter creates a UnaryClientInterceptor for client side rate limiting.
Types ¶
type Config ¶
type Config struct {
MaxRecvMsgSize int `yaml:"max_recv_msg_size" category:"advanced"`
MaxSendMsgSize int `yaml:"max_send_msg_size" category:"advanced"`
GRPCCompression string `yaml:"grpc_compression" category:"advanced"`
RateLimit float64 `yaml:"rate_limit" category:"advanced"`
RateLimitBurst int `yaml:"rate_limit_burst" category:"advanced"`
BackoffOnRatelimits bool `yaml:"backoff_on_ratelimits" category:"advanced"`
BackoffConfig backoff.Config `yaml:"backoff_config"`
InitialStreamWindowSize flagext.Bytes `yaml:"initial_stream_window_size" category:"experimental"`
InitialConnectionWindowSize flagext.Bytes `yaml:"initial_connection_window_size" category:"experimental"`
TLSEnabled bool `yaml:"tls_enabled" category:"advanced"`
TLS tls.ClientConfig `yaml:",inline"`
ConnectTimeout time.Duration `yaml:"connect_timeout" category:"advanced"`
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
ConnectBackoffBaseDelay time.Duration `yaml:"connect_backoff_base_delay" category:"advanced"`
ConnectBackoffMaxDelay time.Duration `yaml:"connect_backoff_max_delay" category:"advanced"`
Middleware []grpc.UnaryClientInterceptor `yaml:"-"`
StreamMiddleware []grpc.StreamClientInterceptor `yaml:"-"`
// CustomCompressors allows configuring custom compressors.
CustomCompressors []string `yaml:"-"`
ClusterValidation clusterutil.ClusterValidationConfig `yaml:"cluster_validation" category:"experimental"`
// contains filtered or unexported fields
}
Config for a gRPC client.
func (*Config) CallOptions ¶
func (cfg *Config) CallOptions() []grpc.CallOption
CallOptions returns the config in terms of CallOptions.
func (*Config) DialOption ¶
func (cfg *Config) DialOption(unaryClientInterceptors []grpc.UnaryClientInterceptor, streamClientInterceptors []grpc.StreamClientInterceptor, invalidClusterValidationReporter middleware.InvalidClusterValidationReporter) ([]grpc.DialOption, error)
DialOption returns the config as a grpc.DialOptions. The passed interceptors wrap around the configured middleware. It requires an InvalidClusterValidationReporter for reporting the cluster validation issues back to the caller, if cluster validation is enabled. If a nil InvalidClusterValidationReporter is provided, a NoOpInvalidClusterValidationReporter is used.
func (*Config) RegisterFlags ¶
RegisterFlags registers flags.
func (*Config) RegisterFlagsWithPrefix ¶
RegisterFlagsWithPrefix registers flags with prefix.