Documentation ¶
Index ¶
- func CreateProxyURL(instance, endpoint string) *url.URL
- func DefaultMiddlewares(method string, requestCount metrics.Counter, requestLatency metrics.Histogram, ...) endpoint.Middleware
- func RequestCountMiddleware(method string, requestCount metrics.Counter) endpoint.Middleware
- func RequestLatencyMiddleware(method string, requestLatency metrics.Histogram) endpoint.Middleware
- func RequestLoggingMiddleware(method string, logger log.Logger) endpoint.Middleware
- type ClientOption
- type LoadBalancerF
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateProxyURL ¶
CreateProxyURL creates an URL as proxy URL
func DefaultMiddlewares ¶
func DefaultMiddlewares(method string, requestCount metrics.Counter, requestLatency metrics.Histogram, logger log.Logger) endpoint.Middleware
DefaultMiddlewares provides bare bones for default middlewares with requestLatency, requestCount and requestLogging
func RequestCountMiddleware ¶
func RequestCountMiddleware(method string, requestCount metrics.Counter) endpoint.Middleware
RequestCountMiddleware prepares a request counter endpoint.Middleware for package wide usage
func RequestLatencyMiddleware ¶
func RequestLatencyMiddleware(method string, requestLatency metrics.Histogram) endpoint.Middleware
RequestLatencyMiddleware prepares a request latency calculator endpoint.Middleware for package wide usage
func RequestLoggingMiddleware ¶
func RequestLoggingMiddleware(method string, logger log.Logger) endpoint.Middleware
RequestLoggingMiddleware prepares a request logger endpoint.Middleware for package wide usage
Types ¶
type ClientOption ¶
type ClientOption struct { // Host holds the host's name Host string // ZipkinCollector holds the collector for zipkin tracing Tracer stdopentracing.Tracer // DisableCircuitBreaker disables circuit breaking functionality DisableCircuitBreaker bool // CircuitBreaker holds the custom circuit breaker, if not set a default one // will be created with default settings CircuitBreaker *gobreaker.CircuitBreaker // DisableRateLimiter disables rate limiting functionality DisableRateLimiter bool // QPS holds the configration parameter for rate limiting outgoing requests // to remote client. Must be set othervise all requests will be blocked // unless rate limiting is disabled QPS int // RateLimiter holds the custom rate limiter, if not set a default one will be created automatically RateLimiter *jujuratelimit.Bucket // TransportOpts holds custom httptransport.ClientOption array will be // appended to the end of the autogenerated ClientOptions TransportOpts []httptransport.ClientOption // Middlewares holds custom endpoint.Middleware array will be appended to // the end of the autogenerated Middlewares Middlewares []endpoint.Middleware // LoadBalancerCreator creates the loadbalancing strategy after getting the factory LoadBalancerCreator LoadBalancerF }
ClientOption holds the required parameters for configuring a client
func (ClientOption) Configure ¶
func (c ClientOption) Configure(moduleName, funcName string) ([]endpoint.Middleware, []httptransport.ClientOption)
Configure prepares middlewares and clientOptions from the client options
If required:
Adds circuitbreaker from "github.com/sony/gobreaker" Adds ratelimiting from "github.com/juju/ratelimit" Adds request tracing from "github.com/go-kit/kit/tracing/zipkin"
type ServerOption ¶
type ServerOption struct { // Host holds the host's name Host string // Tracer holds the collector for zipkin tracing Tracer stdopentracing.Tracer // LogErrors configures whether server should log error responses or not LogErrors bool // LogRequests configures if the server should log incoming requests or not LogRequests bool // Latency holds the metric metric for request latency metric collection, if // not set Latency metrics will not be collected Latency metrics.Histogram // Counter holds the metrics.Counter metric for request count metric // collection, if not set RequestCountMetrics will not be collected Counter metrics.Counter // ServerOptions holds custom httptransport.ServerOption array, will be // appended to the end of the autogenerated ServerOptions []httptransport.ServerOption // Middlewares holds custom endpoint.Middleware array will be appended to // the end of the autogenerated Middlewares Middlewares []endpoint.Middleware }
ServerOption holds the required parameters for configuring a server
func (ServerOption) Configure ¶
func (s ServerOption) Configure(moduleName, funcName string, logger log.Logger) ([]endpoint.Middleware, []httptransport.ServerOption)
Configure prepares middlewares and serverOptions from the client options
If required:
Adds RequestLatencyMiddleware Adds RequestCountMiddleware Adds RequestLoggingMiddleware Adds Zipkin Tracing Adds httptransport.ServerErrorLogger