Documentation ¶
Index ¶
- Constants
- Variables
- func GetAddrFormat(addr string) string
- func GetAddrNextFormat(addr string) string
- func PrintVersion() bool
- type Analysis
- func (a *Analysis) AddTarget(key uint64, interval time.Duration)
- func (a *Analysis) Failure(key uint64)
- func (a *Analysis) GetContinuousFailureCount(server uint64) int
- func (a *Analysis) GetQPS(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyAvg(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyMax(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyMin(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyRejectCount(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyRequestCount(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyRequestFailureCount(server uint64, interval time.Duration) int
- func (a *Analysis) GetRecentlyRequestSuccessedCount(server uint64, interval time.Duration) int
- func (a *Analysis) Reject(key uint64)
- func (a *Analysis) RemoveTarget(key uint64)
- func (a *Analysis) Request(key uint64)
- func (a *Analysis) Response(key uint64, cost int64)
- type Cache
- type FastHTTPClient
- type HTTPOption
- type Key
- type Recently
Constants ¶
const ( // MinAddrFormat min addr format MinAddrFormat = "000000000000000000000" // MaxAddrFormat max addr format MaxAddrFormat = "255.255.255.255:99999" )
Variables ¶
var ( GitCommit = "" BuildTime = "" GoVersion = "" )
set on build time
Functions ¶
func GetAddrFormat ¶
GetAddrFormat returns addr format for sort, padding left by 0
func GetAddrNextFormat ¶
GetAddrNextFormat returns next addr format for sort, padding left by 0
Types ¶
type Analysis ¶
Analysis analysis struct
func NewAnalysis ¶
func NewAnalysis(tw *goetty.TimeoutWheel) *Analysis
NewAnalysis returns a Analysis
func (*Analysis) GetContinuousFailureCount ¶
GetContinuousFailureCount return Continuous failure request count in spec secs
func (*Analysis) GetRecentlyAvg ¶
GetRecentlyAvg return avg latency in spec secs
func (*Analysis) GetRecentlyMax ¶
GetRecentlyMax return max latency in spec secs
func (*Analysis) GetRecentlyMin ¶
GetRecentlyMin return min latency in spec duration
func (*Analysis) GetRecentlyRejectCount ¶
GetRecentlyRejectCount return reject count in spec duration
func (*Analysis) GetRecentlyRequestCount ¶
GetRecentlyRequestCount return the server request count in spec duration
func (*Analysis) GetRecentlyRequestFailureCount ¶
GetRecentlyRequestFailureCount return failure request count in spec duration
func (*Analysis) GetRecentlyRequestSuccessedCount ¶
GetRecentlyRequestSuccessedCount return successed request count in spec secs
func (*Analysis) RemoveTarget ¶
RemoveTarget remove analysis point on a key
type Cache ¶
type Cache struct { sync.RWMutex // MaxBytes is the maximum bytes of cache entries before // an item is evicted. Zero means no limit. MaxBytes uint64 // OnEvicted optionally specificies a callback function to be // executed when an entry is purged from the cache. OnEvicted func(key Key, value interface{}) // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access.
func NewLRUCache ¶
NewLRUCache creates a new Cache. If maxBytes is zero, the cache has no limit and it's assumed that eviction is done by the caller.
type FastHTTPClient ¶
FastHTTPClient fast http client
func NewFastHTTPClient ¶
func NewFastHTTPClient() *FastHTTPClient
NewFastHTTPClient create FastHTTPClient instance
func NewFastHTTPClientOption ¶
func NewFastHTTPClientOption(defaultOption *HTTPOption) *FastHTTPClient
NewFastHTTPClientOption create FastHTTPClient instance with default option
func (*FastHTTPClient) Do ¶
func (c *FastHTTPClient) Do(req *fasthttp.Request, addr string, option *HTTPOption) (*fasthttp.Response, error)
Do do a http request
type HTTPOption ¶
type HTTPOption struct { // Maximum number of connections which may be established to server MaxConns int // MaxConnDuration Keep-alive connections are closed after this duration. MaxConnDuration time.Duration // MaxIdleConnDuration Idle keep-alive connections are closed after this duration. MaxIdleConnDuration time.Duration // ReadBufferSize Per-connection buffer size for responses' reading. ReadBufferSize int // WriteBufferSize Per-connection buffer size for requests' writing. WriteBufferSize int // ReadTimeout Maximum duration for full response reading (including body). ReadTimeout time.Duration // WriteTimeout Maximum duration for full request writing (including body). WriteTimeout time.Duration // MaxResponseBodySize Maximum response body size. MaxResponseBodySize int }
HTTPOption http client option
func DefaultHTTPOption ¶
func DefaultHTTPOption() *HTTPOption
DefaultHTTPOption returns a HTTP Option
type Key ¶
type Key interface{}
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators