state

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory added in v1.0.0

type Factory interface {
	Create() State
}

Factory interface for making new state instances

type GaugeFactory added in v1.0.0

type GaugeFactory interface {
	Create(metric string, labelKeys []string) GaugeVec
}

GaugeFactory interface for making new GaugeVec instances

type GaugeVec added in v1.0.0

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

GaugeVec interface for gauge vectors in prometheus backend

type Log

type Log struct{}

Log struct is State interface implementation that writes all states to log

func (*Log) Set

func (s *Log) Set(metric string, n int, labels ...map[string]string)

Set sets metric state

type Memory

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

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

func NewMemory

func NewMemory() *Memory

NewMemory builds and returns new Memory instance

func (*Memory) Metrics

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

Metrics returns all previously stored metrics

func (*Memory) Set

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

Set sets metric state

type Prometheus added in v1.0.0

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

Prometheus struct is State interface implementation that writes all states

func NewPrometheus added in v1.0.0

func NewPrometheus(gaugeFactory GaugeFactory) *Prometheus

NewPrometheus creates new prometheus state instance

func (*Prometheus) Set added in v1.0.0

func (s *Prometheus) Set(metric string, n int, labels ...map[string]string)

Set sets metric state

type PrometheusGaugeFactory added in v1.0.0

type PrometheusGaugeFactory struct{}

PrometheusGaugeFactory implements GaugeFactory interface

func NewPrometheusGaugeFactory added in v1.0.0

func NewPrometheusGaugeFactory() *PrometheusGaugeFactory

NewPrometheusGaugeFactory returns new PrometheusGaugeFactory instance

func (*PrometheusGaugeFactory) Create added in v1.0.0

func (f *PrometheusGaugeFactory) Create(metric string, labelKeys []string) GaugeVec

Create method returns new GaugeVec instance with metric and labelKeys attributes

type PrometheusStateFactory added in v1.0.0

type PrometheusStateFactory struct{}

PrometheusStateFactory implements Factory interface

func NewPrometheusStateFactory added in v1.0.0

func NewPrometheusStateFactory() *PrometheusStateFactory

NewPrometheusStateFactory returns new NewPrometheusIncrementerFactory instance

func (*PrometheusStateFactory) Create added in v1.0.0

func (p *PrometheusStateFactory) Create() State

Create method returns new Prometheus incrementer instance

type State

type State interface {
	// Set sets metric state
	Set(metric string, n int, labels ...map[string]string)
}

State is a metric state interface

type StatsD added in v0.6.0

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

StatsD struct is State interface implementation that writes all states to statsd gauge

func NewStatsD added in v0.6.0

func NewStatsD(c *statsd.Client) *StatsD

NewStatsD creates new statsd state instance

func (*StatsD) Set added in v0.6.0

func (s *StatsD) Set(metric string, n int, labels ...map[string]string)

Set sets metric state

Jump to

Keyboard shortcuts

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