Documentation
¶
Index ¶
- Constants
- Variables
- func IsConnTimeoutErr(err error) bool
- func WithConsTimeoutEnabled(val bool) func(*HTTPClient) error
- func WithCustomTransport(dialtimeout, tlstimeout int) func(*HTTPClient) error
- func WithDefaultTimeout(val int) func(*HTTPClient) error
- func WithMaxDefaultTimeout(val int) func(*HTTPClient) error
- func WithSlidingWindowEnabled(val bool) func(*HTTPClient) error
- func WithSlidingWindowSize(val int) func(*HTTPClient) error
- func WithSlidingWindowThreshold(val int) func(*HTTPClient) error
- func WithTimeoutIncInterval(val int) func(*HTTPClient) error
- func WithTimeoutReportCount(val int) func(*HTTPClient) error
- func WithZaplogger(log *zap.SugaredLogger) func(*HTTPClient) error
- type HTTPClient
- type HTTPStats
- type Option
- type Window
Constants ¶
View Source
const ( ClientDefaultTimeout = time.Duration(1000) * time.Millisecond // Sec ClientTimeoutIncInterval = time.Duration(2000) * time.Millisecond // Sec ClientTimeoutReportCount = 5 // Count ClientWindowDefaultThreshold = 70 // indicates % of timeout reports when window is full ClientWindowDefaultSize = 5 // Window Size )
View Source
const ( DNSLookup = "DNSLookup" TCPConnection = "TCPConnection" TLSHandshake = "TLSHandshake" ServerProcessing = "ServerProcessing" ContentTransfer = "ContentTransfer" Total = "Total" )
View Source
const ( DNS_TIMEOUT = "dial tcp" TLS_TIMEOUT = "TLS handshake timeout" REQ_TIMEOUT = "Client.Timeout exceeded while awaiting headers" )
View Source
const ( INVALID = -1 DNS_TIMEOUT_I = 1 TLS_TIMEOUT_I = 2 REQ_TIMEOUT_I = 4 )
View Source
const PERCENT = "%"
Variables ¶
View Source
var TIMEOUT_CAUSE = map[int]string{ DNS_TIMEOUT_I: DNS_TIMEOUT, TLS_TIMEOUT_I: TLS_TIMEOUT, REQ_TIMEOUT_I: REQ_TIMEOUT, }
Functions ¶
func IsConnTimeoutErr ¶
func WithConsTimeoutEnabled ¶
func WithConsTimeoutEnabled(val bool) func(*HTTPClient) error
func WithCustomTransport ¶
func WithCustomTransport(dialtimeout, tlstimeout int) func(*HTTPClient) error
func WithDefaultTimeout ¶
func WithDefaultTimeout(val int) func(*HTTPClient) error
func WithMaxDefaultTimeout ¶
func WithMaxDefaultTimeout(val int) func(*HTTPClient) error
func WithSlidingWindowEnabled ¶
func WithSlidingWindowEnabled(val bool) func(*HTTPClient) error
func WithSlidingWindowSize ¶
func WithSlidingWindowSize(val int) func(*HTTPClient) error
func WithSlidingWindowThreshold ¶
func WithSlidingWindowThreshold(val int) func(*HTTPClient) error
func WithTimeoutIncInterval ¶
func WithTimeoutIncInterval(val int) func(*HTTPClient) error
func WithTimeoutReportCount ¶
func WithTimeoutReportCount(val int) func(*HTTPClient) error
func WithZaplogger ¶
func WithZaplogger(log *zap.SugaredLogger) func(*HTTPClient) error
Types ¶
type HTTPClient ¶
type HTTPClient struct {
*http.Client
Dialer func(ctx context.Context, network string, address string) (net.Conn, error)
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(h *http.Client, opts ...Option) (*HTTPClient, error)
func (*HTTPClient) NotifySlidingWindow ¶
func (h *HTTPClient) NotifySlidingWindow(stats *HTTPStats)
type HTTPStats ¶
type HTTPStats struct {
DNSLookup int `json:"DNSLookup"`
TCPConnection int `json:"TCPConnection"`
TLSHandshake int `json:"TLSHandshake"`
ServerProcessing int `json:"ServerProcessing"`
ContentTransfer int `json:"ContentTransfer"`
Total int `json:"Total"`
URL string `json:"URL"`
ReqTimeout int `json:"ClientTimeout"`
DnsTimeout int `json:"DNSTimeout"`
TlsTimeout int `json:"TLSTimeout"`
TimeoutReason int `json:"TimeoutReason"`
Message string `json:"message"`
}
type Option ¶
type Option func(*HTTPClient) error
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
func (*Window) GetTimeoutThreshold ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.