client

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 13 Imported by: 7 modules, 40 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// BuildTimer builds timer to track metric timings
	BuildTimer() timer.Timer

	// Close closes underlying client connection if any
	Close() error

	// TrackRequest tracks HTTP Request stats
	TrackRequest(r *http.Request, t timer.Timer, success bool) Client

	// TrackOperation tracks custom operation
	TrackOperation(section string, operation *bucket.MetricOperation, t timer.Timer, success bool) Client

	// TrackOperationN tracks custom operation with n diff
	TrackOperationN(section string, operation *bucket.MetricOperation, t timer.Timer, n int, success bool) Client

	// TrackMetric tracks custom metric, w/out ok/fail additional sections
	TrackMetric(section string, operation *bucket.MetricOperation) Client

	// TrackMetricN tracks custom metric with n diff, w/out ok/fail additional sections
	TrackMetricN(section string, operation *bucket.MetricOperation, n int) Client

	// TrackState tracks metric absolute value
	TrackState(section string, operation *bucket.MetricOperation, value int) Client

	// SetHTTPMetricCallback sets callback handler that allows metric operation alteration for HTTP Request
	SetHTTPMetricCallback(callback bucket.HTTPMetricNameAlterCallback) Client

	// GetHTTPMetricCallback gets callback handler that allows metric operation alteration for HTTP Request
	GetHTTPMetricCallback() bucket.HTTPMetricNameAlterCallback

	// SetHTTPRequestSection sets metric section for HTTP Request metrics
	SetHTTPRequestSection(section string) Client

	// ResetHTTPRequestSection resets metric section for HTTP Request metrics to default value that is "request"
	ResetHTTPRequestSection() Client

	// Handler returns metrics endpoint for prometheus backend
	Handler() http.Handler
}

Client is an interface for different methods of gathering stats

type Log

type Log struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Log is Client implementation for debug log

func NewLog

func NewLog(unicode bool) *Log

NewLog builds and returns new Log instance

func (*Log) BuildTimer

func (c *Log) BuildTimer() timer.Timer

BuildTimer builds timer to track metric timings

func (*Log) Close

func (c *Log) Close() error

Close statsd connection

func (*Log) GetHTTPMetricCallback

func (c *Log) GetHTTPMetricCallback() bucket.HTTPMetricNameAlterCallback

GetHTTPMetricCallback gets callback handler that allows metric operation alteration for HTTP Request

func (*Log) Handler added in v1.0.0

func (c *Log) Handler() http.Handler

Handler returns metrics endpoint for prometheus backend

func (*Log) ResetHTTPRequestSection

func (c *Log) ResetHTTPRequestSection() Client

ResetHTTPRequestSection resets metric section for HTTP Request metrics to default value that is "request"

func (*Log) SetHTTPMetricCallback

func (c *Log) SetHTTPMetricCallback(callback bucket.HTTPMetricNameAlterCallback) Client

SetHTTPMetricCallback sets callback handler that allows metric operation alteration for HTTP Request

func (*Log) SetHTTPRequestSection

func (c *Log) SetHTTPRequestSection(section string) Client

SetHTTPRequestSection sets metric section for HTTP Request metrics

func (*Log) TrackMetric

func (c *Log) TrackMetric(section string, operation *bucket.MetricOperation) Client

TrackMetric tracks custom metric, w/out ok/fail additional sections

func (*Log) TrackMetricN

func (c *Log) TrackMetricN(section string, operation *bucket.MetricOperation, n int) Client

TrackMetricN tracks custom metric with n diff, w/out ok/fail additional sections

func (*Log) TrackOperation

func (c *Log) TrackOperation(section string, operation *bucket.MetricOperation, t timer.Timer, success bool) Client

TrackOperation tracks custom operation

func (*Log) TrackOperationN

func (c *Log) TrackOperationN(section string, operation *bucket.MetricOperation, t timer.Timer, n int, success bool) Client

TrackOperationN tracks custom operation with n diff

func (*Log) TrackRequest

func (c *Log) TrackRequest(r *http.Request, t timer.Timer, success bool) Client

TrackRequest tracks HTTP Request stats

func (*Log) TrackState

func (c *Log) TrackState(section string, operation *bucket.MetricOperation, value int) Client

TrackState tracks metric absolute value

type Memory

type Memory struct {
	sync.Mutex

	TimerMetrics []Metric
	CountMetrics map[string]int
	StateMetrics map[string]int
	// contains filtered or unexported fields
}

Memory is Client implementation for tests

func NewMemory

func NewMemory(unicode bool) *Memory

NewMemory builds and returns new Memory instance

func (*Memory) BuildTimer

func (c *Memory) BuildTimer() timer.Timer

BuildTimer builds timer to track metric timings

func (*Memory) Close

func (c *Memory) Close() error

Close resets all collected stats

func (*Memory) GetHTTPMetricCallback

func (c *Memory) GetHTTPMetricCallback() bucket.HTTPMetricNameAlterCallback

GetHTTPMetricCallback gets callback handler that allows metric operation alteration for HTTP Request

func (*Memory) Handler added in v1.0.0

func (c *Memory) Handler() http.Handler

Handler returns metrics endpoint for prometheus backend

func (*Memory) ResetHTTPRequestSection

func (c *Memory) ResetHTTPRequestSection() Client

ResetHTTPRequestSection resets metric section for HTTP Request metrics to default value that is "request"

func (*Memory) SetHTTPMetricCallback

func (c *Memory) SetHTTPMetricCallback(callback bucket.HTTPMetricNameAlterCallback) Client

SetHTTPMetricCallback sets callback handler that allows metric operation alteration for HTTP Request

func (*Memory) SetHTTPRequestSection

func (c *Memory) SetHTTPRequestSection(section string) Client

SetHTTPRequestSection sets metric section for HTTP Request metrics

func (*Memory) TrackMetric

func (c *Memory) TrackMetric(section string, operation *bucket.MetricOperation) Client

TrackMetric tracks custom metric, w/out ok/fail additional sections

func (*Memory) TrackMetricN

func (c *Memory) TrackMetricN(section string, operation *bucket.MetricOperation, n int) Client

TrackMetricN tracks custom metric with n diff, w/out ok/fail additional sections

func (*Memory) TrackOperation

func (c *Memory) TrackOperation(section string, operation *bucket.MetricOperation, t timer.Timer, success bool) Client

TrackOperation tracks custom operation

func (*Memory) TrackOperationN

func (c *Memory) TrackOperationN(section string, operation *bucket.MetricOperation, t timer.Timer, n int, success bool) Client

TrackOperationN tracks custom operation with n diff

func (*Memory) TrackRequest

func (c *Memory) TrackRequest(r *http.Request, t timer.Timer, success bool) Client

TrackRequest tracks HTTP Request stats

func (*Memory) TrackState

func (c *Memory) TrackState(section string, operation *bucket.MetricOperation, value int) Client

TrackState tracks metric absolute value

type Metric added in v0.8.0

type Metric struct {
	Bucket  string
	Elapsed time.Duration
}

Metric is a type for storing single duration metric

type Noop

type Noop struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Noop is Client implementation that does literally nothing

func NewNoop

func NewNoop() *Noop

NewNoop builds and returns new Noop instance

func (*Noop) BuildTimer

func (c *Noop) BuildTimer() timer.Timer

BuildTimer builds timer to track metric timings

func (*Noop) Close

func (c *Noop) Close() error

Close closes underlying client connection if any

func (*Noop) GetHTTPMetricCallback

func (c *Noop) GetHTTPMetricCallback() bucket.HTTPMetricNameAlterCallback

GetHTTPMetricCallback gets callback handler that allows metric operation alteration for HTTP Request

func (*Noop) Handler added in v1.0.0

func (c *Noop) Handler() http.Handler

Handler returns metrics endpoint for prometheus backend

func (*Noop) ResetHTTPRequestSection

func (c *Noop) ResetHTTPRequestSection() Client

ResetHTTPRequestSection resets metric section for HTTP Request metrics to default value that is "request"

func (*Noop) SetHTTPMetricCallback

func (c *Noop) SetHTTPMetricCallback(callback bucket.HTTPMetricNameAlterCallback) Client

SetHTTPMetricCallback sets callback handler that allows metric operation alteration for HTTP Request

func (*Noop) SetHTTPRequestSection

func (c *Noop) SetHTTPRequestSection(section string) Client

SetHTTPRequestSection sets metric section for HTTP Request metrics

func (*Noop) TrackMetric

func (c *Noop) TrackMetric(section string, operation *bucket.MetricOperation) Client

TrackMetric tracks custom metric, w/out ok/fail additional sections

func (*Noop) TrackMetricN

func (c *Noop) TrackMetricN(section string, operation *bucket.MetricOperation, n int) Client

TrackMetricN tracks custom metric with n diff, w/out ok/fail additional sections

func (*Noop) TrackOperation

func (c *Noop) TrackOperation(section string, operation *bucket.MetricOperation, t timer.Timer, success bool) Client

TrackOperation tracks custom operation

func (*Noop) TrackOperationN

func (c *Noop) TrackOperationN(section string, operation *bucket.MetricOperation, t timer.Timer, n int, success bool) Client

TrackOperationN tracks custom operation with n diff

func (*Noop) TrackRequest

func (c *Noop) TrackRequest(r *http.Request, t timer.Timer, success bool) Client

TrackRequest tracks HTTP Request stats

func (*Noop) TrackState

func (c *Noop) TrackState(section string, operation *bucket.MetricOperation, value int) Client

TrackState tracks metric absolute value

type Prometheus added in v1.0.0

type Prometheus struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Prometheus is Client implementation for prometheus

func NewPrometheus added in v1.0.0

func NewPrometheus(namespace string, incFactory incrementer.Factory, stFactory state.Factory) *Prometheus

NewPrometheus builds and returns new Prometheus instance

func (*Prometheus) BuildTimer added in v1.0.0

func (c *Prometheus) BuildTimer() timer.Timer

BuildTimer builds timer to track metric timings

func (*Prometheus) Close added in v1.0.0

func (c *Prometheus) Close() error

Close closes underlying client connection if any

func (*Prometheus) GetHTTPMetricCallback added in v1.0.0

func (c *Prometheus) GetHTTPMetricCallback() bucket.HTTPMetricNameAlterCallback

GetHTTPMetricCallback gets callback handler that allows metric operation alteration for HTTP Request

func (*Prometheus) Handler added in v1.0.0

func (c *Prometheus) Handler() http.Handler

Handler returns metrics endpoint for prometheus backend

func (*Prometheus) ResetHTTPRequestSection added in v1.0.0

func (c *Prometheus) ResetHTTPRequestSection() Client

ResetHTTPRequestSection resets metric section for HTTP Request metrics to default value that is "request"

func (*Prometheus) SetHTTPMetricCallback added in v1.0.0

func (c *Prometheus) SetHTTPMetricCallback(callback bucket.HTTPMetricNameAlterCallback) Client

SetHTTPMetricCallback sets callback handler that allows metric operation alteration for HTTP Request

func (*Prometheus) SetHTTPRequestSection added in v1.0.0

func (c *Prometheus) SetHTTPRequestSection(section string) Client

SetHTTPRequestSection sets metric section for HTTP Request metrics

func (*Prometheus) TrackMetric added in v1.0.0

func (c *Prometheus) TrackMetric(section string, operation *bucket.MetricOperation) Client

TrackMetric tracks custom metric, w/out ok/fail additional sections

func (*Prometheus) TrackMetricN added in v1.0.0

func (c *Prometheus) TrackMetricN(section string, operation *bucket.MetricOperation, n int) Client

TrackMetricN tracks custom metric with n diff, w/out ok/fail additional sections

func (*Prometheus) TrackOperation added in v1.0.0

func (c *Prometheus) TrackOperation(section string, operation *bucket.MetricOperation, t timer.Timer, success bool) Client

TrackOperation tracks custom operation

func (*Prometheus) TrackOperationN added in v1.0.0

func (c *Prometheus) TrackOperationN(section string, operation *bucket.MetricOperation, t timer.Timer, n int, success bool) Client

TrackOperationN tracks custom operation with n diff

func (*Prometheus) TrackRequest added in v1.0.0

func (c *Prometheus) TrackRequest(r *http.Request, t timer.Timer, success bool) Client

TrackRequest tracks HTTP Request stats

func (*Prometheus) TrackState added in v1.0.0

func (c *Prometheus) TrackState(section string, operation *bucket.MetricOperation, value int) Client

TrackState tracks metric absolute value

type StatsD

type StatsD struct {
	sync.Mutex
	// contains filtered or unexported fields
}

StatsD is Client implementation for statsd

func NewStatsD

func NewStatsD(addr string, prefix string, unicode bool) (*StatsD, error)

NewStatsD builds and returns new StatsD instance

func (*StatsD) BuildTimer

func (c *StatsD) BuildTimer() timer.Timer

BuildTimer builds timer to track metric timings

func (*StatsD) Close

func (c *StatsD) Close() error

Close statsd connection

func (*StatsD) GetHTTPMetricCallback

func (c *StatsD) GetHTTPMetricCallback() bucket.HTTPMetricNameAlterCallback

GetHTTPMetricCallback gets callback handler that allows metric operation alteration for HTTP Request

func (*StatsD) Handler added in v1.0.0

func (c *StatsD) Handler() http.Handler

Handler returns metrics endpoint for prometheus backend

func (*StatsD) ResetHTTPRequestSection

func (c *StatsD) ResetHTTPRequestSection() Client

ResetHTTPRequestSection resets metric section for HTTP Request metrics to default value that is "request"

func (*StatsD) SetHTTPMetricCallback

func (c *StatsD) SetHTTPMetricCallback(callback bucket.HTTPMetricNameAlterCallback) Client

SetHTTPMetricCallback sets callback handler that allows metric operation alteration for HTTP Request

func (*StatsD) SetHTTPRequestSection

func (c *StatsD) SetHTTPRequestSection(section string) Client

SetHTTPRequestSection sets metric section for HTTP Request metrics

func (*StatsD) TrackMetric

func (c *StatsD) TrackMetric(section string, operation *bucket.MetricOperation) Client

TrackMetric tracks custom metric, w/out ok/fail additional sections

func (*StatsD) TrackMetricN

func (c *StatsD) TrackMetricN(section string, operation *bucket.MetricOperation, n int) Client

TrackMetricN tracks custom metric with n diff, w/out ok/fail additional sections

func (*StatsD) TrackOperation

func (c *StatsD) TrackOperation(section string, operation *bucket.MetricOperation, t timer.Timer, success bool) Client

TrackOperation tracks custom operation

func (*StatsD) TrackOperationN

func (c *StatsD) TrackOperationN(section string, operation *bucket.MetricOperation, t timer.Timer, n int, success bool) Client

TrackOperationN tracks custom operation with n diff

func (*StatsD) TrackRequest

func (c *StatsD) TrackRequest(r *http.Request, t timer.Timer, success bool) Client

TrackRequest tracks HTTP Request stats

func (*StatsD) TrackState

func (c *StatsD) TrackState(section string, operation *bucket.MetricOperation, value int) Client

TrackState tracks metric absolute value

Jump to

Keyboard shortcuts

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