metrics

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HoneycombMetrics

type HoneycombMetrics struct {
	Config            config.Config   `inject:""`
	Logger            logger.Logger   `inject:""`
	UpstreamTransport *http.Transport `inject:"upstreamTransport"`
	Version           string          `inject:"version"`
	// contains filtered or unexported fields
}

func (*HoneycombMetrics) Gauge

func (h *HoneycombMetrics) Gauge(name string, val float64)

func (*HoneycombMetrics) Histogram

func (h *HoneycombMetrics) Histogram(name string, obs float64)

func (*HoneycombMetrics) IncrementCounter

func (h *HoneycombMetrics) IncrementCounter(name string)

func (*HoneycombMetrics) Register

func (h *HoneycombMetrics) Register(name string, metricType string)

func (*HoneycombMetrics) Start

func (h *HoneycombMetrics) Start() error

type Metrics

type Metrics interface {
	// Register declares a metric; metricType should be one of counter, gauge, histogram
	Register(name string, metricType string)
	IncrementCounter(name string)
	Gauge(name string, val float64)
	Histogram(name string, obs float64)
}

func GetMetricsImplementation

func GetMetricsImplementation(c config.Config) Metrics

type MockMetrics

type MockMetrics struct {
	Registrations     map[string]string
	CounterIncrements map[string]int
	GaugeRecords      map[string]float64
	Histograms        map[string][]float64
	// contains filtered or unexported fields
}

MockMetrics collects metrics that were registered and changed to allow tests to verify expected behavior

func (*MockMetrics) Gauge

func (m *MockMetrics) Gauge(name string, val float64)

func (*MockMetrics) Histogram

func (m *MockMetrics) Histogram(name string, obs float64)

func (*MockMetrics) IncrementCounter

func (m *MockMetrics) IncrementCounter(name string)

func (*MockMetrics) Register

func (m *MockMetrics) Register(name string, metricType string)

func (*MockMetrics) Start

func (m *MockMetrics) Start()

Start initializes all metrics or resets all metrics to zero

type NullMetrics

type NullMetrics struct{}

NullMetrics discards all metrics

func (*NullMetrics) Gauge

func (n *NullMetrics) Gauge(name string, val float64)

func (*NullMetrics) Histogram

func (n *NullMetrics) Histogram(name string, obs float64)

func (*NullMetrics) IncrementCounter

func (n *NullMetrics) IncrementCounter(name string)

func (*NullMetrics) Register

func (n *NullMetrics) Register(name string, metricType string)

func (*NullMetrics) Start

func (n *NullMetrics) Start()

Start initializes all metrics or resets all metrics to zero

type PromMetrics

type PromMetrics struct {
	Config config.Config `inject:""`
	Logger logger.Logger `inject:""`
	// contains filtered or unexported fields
}

func (*PromMetrics) Gauge

func (p *PromMetrics) Gauge(name string, val float64)

func (*PromMetrics) Histogram

func (p *PromMetrics) Histogram(name string, obs float64)

func (*PromMetrics) IncrementCounter

func (p *PromMetrics) IncrementCounter(name string)

func (*PromMetrics) Register

func (p *PromMetrics) Register(name string, metricType string)

Register takes a name and a metric type. The type should be one of "counter", "gauge", or "histogram"

func (*PromMetrics) Start

func (p *PromMetrics) Start() error

Jump to

Keyboard shortcuts

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