fastclient

package
v0.0.0-...-2d0c9e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Jobsch is a channel of tasks(requests) which should be done
	Jobsch chan struct{}

	*fasthttp.HostClient

	sync.Mutex
	// contains filtered or unexported fields
}

Client is a wrapper for fasthttp.HostClient It allows to send requests and collect metrics while sending

func New

func New(request *fasthttp.Request, timeout time.Duration, sc int) *Client

New creates new client

func (*Client) Amount

func (c *Client) Amount() int

Amount return number of created workers after Flush() workers would flushed too

func (*Client) BytesRead

func (*Client) BytesRead() uint64

BytesRead returns value of bytesRead-metric

func (*Client) BytesWritten

func (*Client) BytesWritten() uint64

BytesWritten returns value of bytesWritten-metric

func (*Client) ConnOpen

func (*Client) ConnOpen() uint64

ConnOpen returns value of connOpen-metric

func (*Client) ErrorMessages

func (c *Client) ErrorMessages() map[string]int

ErrorMessages returns map errorMessage:value for errorMessages-metric where value is a number of errors with same message

func (*Client) Errors

func (*Client) Errors() uint64

Errors returns value of errors-metric

func (*Client) Flush

func (c *Client) Flush()

Flush dropping out and re-init all counters and metrics

func (*Client) Overflow

func (c *Client) Overflow() int

Overflow return length of job-channel after calling Flush(), channel would flushed too

func (*Client) RequestDuration

func (*Client) RequestDuration() map[float64]float64

RequestDuration returns map quantile:value for requestDuration-metric

func (*Client) RequestSuccess

func (*Client) RequestSuccess() uint64

RequestSuccess returns value of requestSuccess-metric

func (*Client) RequestSum

func (*Client) RequestSum() uint64

RequestSum returns value of requestSum-metric

func (*Client) RunWorkers

func (c *Client) RunWorkers(n int)

RunWorkers runs n goroutines to serve jobs from Jobsch

func (*Client) StatusCodes

func (c *Client) StatusCodes() map[string]float64

StatusCodes returns map statusCode:value for statusCodes-metric where value is an percent of total number of requests

func (*Client) Timeouts

func (*Client) Timeouts() uint64

Timeouts returns value of timeouts-metric

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL