incrementer

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: 5 Imported by: ? modules, 0 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 CounterFactory added in v1.0.0

type CounterFactory interface {
	Create(metric string, labelKeys []string) CounterVec
}

CounterFactory interface for making new CounterVec instances

type CounterVec added in v1.0.0

type CounterVec interface {
	GetMetricWithLabelValues(lvs ...string) (prometheus.Counter, error)
	GetMetricWith(labels prometheus.Labels) (prometheus.Counter, error)
	WithLabelValues(lvs ...string) prometheus.Counter
	With(labels prometheus.Labels) prometheus.Counter
}

CounterVec interface for counter vectors in prometheus backend

type Factory added in v1.0.0

type Factory interface {
	Create() Incrementer
}

Factory interface for making new incrementer instances

type Incrementer

type Incrementer interface {
	// Increment increments metric
	Increment(metric string, labels ...map[string]string)

	// IncrementN increments metric by n
	IncrementN(metric string, n int, labels ...map[string]string)

	// Increment increments all metrics for given bucket
	IncrementAll(b bucket.Bucket)

	// Increment increments all metrics for given bucket by n
	IncrementAllN(b bucket.Bucket, n int)
}

Incrementer is a metric incrementer interface

type Log

type Log struct{}

Log struct is Incrementer interface implementation that writes all metrics to log

func (*Log) Increment

func (i *Log) Increment(metric string, labels ...map[string]string)

Increment writes given metric to log

func (*Log) IncrementAll

func (i *Log) IncrementAll(b bucket.Bucket)

IncrementAll writes all metrics for given bucket to log

func (*Log) IncrementAllN

func (i *Log) IncrementAllN(b bucket.Bucket, n int)

IncrementAllN writes all metrics for given bucket to log

func (*Log) IncrementN

func (i *Log) IncrementN(metric string, n int, labels ...map[string]string)

IncrementN writes given metric to log

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory struct is Incrementer interface implementation that stores results in memory for further usage

func NewMemory

func NewMemory() *Memory

NewMemory builds and returns new Memory instance

func (*Memory) Increment

func (i *Memory) Increment(metric string, labels ...map[string]string)

Increment increments given metric in memory

func (*Memory) IncrementAll

func (i *Memory) IncrementAll(b bucket.Bucket)

IncrementAll increments all metrics for given bucket in memory

func (*Memory) IncrementAllN

func (i *Memory) IncrementAllN(b bucket.Bucket, n int)

IncrementAllN increments all metrics for given bucket in memory

func (*Memory) IncrementN

func (i *Memory) IncrementN(metric string, n int, labels ...map[string]string)

IncrementN increments given metric in memory

func (*Memory) Metrics

func (i *Memory) Metrics() map[string]int

Metrics returns all previously stored metrics

type Prometheus added in v1.0.0

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

Prometheus struct is Incrementer interface implementation that writes all metrics to Prometheus

func NewPrometheus added in v1.0.0

func NewPrometheus(counterFactory CounterFactory) *Prometheus

NewPrometheus creates new prometheus incrementer instance

func (*Prometheus) Increment added in v1.0.0

func (i *Prometheus) Increment(metric string, labels ...map[string]string)

Increment increments metric in prometheus

func (*Prometheus) IncrementAll added in v1.0.0

func (i *Prometheus) IncrementAll(b bucket.Bucket)

IncrementAll increments all metrics for given bucket in prometheus

func (*Prometheus) IncrementAllN added in v1.0.0

func (i *Prometheus) IncrementAllN(b bucket.Bucket, n int)

IncrementAllN increments all metrics for given bucket in prometheus

func (*Prometheus) IncrementN added in v1.0.0

func (i *Prometheus) IncrementN(metric string, n int, labels ...map[string]string)

IncrementN increments metric by n in prometheus

type PrometheusCounterFactory added in v1.0.0

type PrometheusCounterFactory struct{}

PrometheusCounterFactory implements CounterFactory interface

func NewPrometheusCounterFactory added in v1.0.0

func NewPrometheusCounterFactory() *PrometheusCounterFactory

NewPrometheusCounterFactory returns new PrometheusCounterFactory instance

func (*PrometheusCounterFactory) Create added in v1.0.0

func (f *PrometheusCounterFactory) Create(metric string, labelKeys []string) CounterVec

Create method returns new CounterVec instance with metric and labelKeys attributes

type PrometheusIncrementerFactory added in v1.0.0

type PrometheusIncrementerFactory struct{}

PrometheusIncrementerFactory implements Factory interface

func NewPrometheusIncrementerFactory added in v1.0.0

func NewPrometheusIncrementerFactory() *PrometheusIncrementerFactory

NewPrometheusIncrementerFactory returns new NewPrometheusIncrementerFactory instance

func (*PrometheusIncrementerFactory) Create added in v1.0.0

Create method returns new Prometheus incrementer instance

type StatsD added in v0.6.0

type StatsD struct {
	// contains filtered or unexported fields
}

StatsD struct is Incrementer interface implementation that writes all metrics to statsd

func NewStatsD added in v0.6.0

func NewStatsD(c *statsd.Client) *StatsD

NewStatsD creates new statsd incrementer instance

func (*StatsD) Increment added in v0.6.0

func (i *StatsD) Increment(metric string, labels ...map[string]string)

Increment increments metric in statsd

func (*StatsD) IncrementAll added in v0.6.0

func (i *StatsD) IncrementAll(b bucket.Bucket)

IncrementAll increments all metrics for given bucket in statsd

func (*StatsD) IncrementAllN added in v0.6.0

func (i *StatsD) IncrementAllN(b bucket.Bucket, n int)

IncrementAllN increments all metrics for given bucket in statsd

func (*StatsD) IncrementN added in v0.6.0

func (i *StatsD) IncrementN(metric string, n int, labels ...map[string]string)

IncrementN increments metric by n in statsd

Jump to

Keyboard shortcuts

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