observability

package
v0.0.0-...-edc748c Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGlobalMetricsRepository

func NewGlobalMetricsRepository(mr MetricsRepository) *globalMetricsRepository

func OnMetricsRepositoryGlobalSet

func OnMetricsRepositoryGlobalSet(f globalMetricsRepositoryChangeCallback)

func SetGlobalMetricsRepository

func SetGlobalMetricsRepository(mr MetricsRepository)

Types

type CountRegistry

type CountRegistry interface {
	Count(name string, l Labels) Counter

	// CountVec doesn't need constant labels (i.e. predefined label key(s) and value(s)), just constant label keys
	CountVec(name string, labelKeys ...string) CounterVec

	CountFunc(name string, l Labels) CounterFunc
}

CountRegistry implements various Counter metrics. When choosing the Counter type, keep in mind that each Counter type has its pros and cons. Check the implementation's documentation for details.

type CountRegistryStub

type CountRegistryStub struct{}

func (CountRegistryStub) Count

func (c CountRegistryStub) Count(_ string, _ Labels) Counter

func (CountRegistryStub) CountFunc

func (c CountRegistryStub) CountFunc(_ string, _ Labels) CounterFunc

func (CountRegistryStub) CountVec

func (c CountRegistryStub) CountVec(_ string, _ ...string) CounterVec

type Counter

type Counter interface {
	Inc()
	Add(count int)
	Get() int
}

type CounterFunc

type CounterFunc interface {
	CounterFuncRegister(fn func() float64)
	CounterFuncDeregister()
}

type CounterFuncStub

type CounterFuncStub struct{}

func (CounterFuncStub) CounterFuncDeregister

func (c CounterFuncStub) CounterFuncDeregister()

func (CounterFuncStub) CounterFuncRegister

func (c CounterFuncStub) CounterFuncRegister(_ func() float64)

type CounterStub

type CounterStub int

func (*CounterStub) Add

func (c *CounterStub) Add(i int)

func (*CounterStub) Get

func (c *CounterStub) Get() int

func (*CounterStub) Inc

func (c *CounterStub) Inc()

type CounterVec

type CounterVec interface {
	Inc(labelValues ...string)
	Add(count int, labelValues ...string)
}

type CounterVecStub

type CounterVecStub struct{}

func (CounterVecStub) Add

func (c CounterVecStub) Add(_ int, _ ...string)

func (CounterVecStub) Inc

func (c CounterVecStub) Inc(_ ...string)

type Gauge

type Gauge interface {
	Set(f float64)
}

type GaugeFunc

type GaugeFunc interface {
	GaugeFuncRegister(fn func() float64)
	GaugeFuncDeregister()
}

type GaugeFuncStub

type GaugeFuncStub struct{}

func (GaugeFuncStub) GaugeFuncDeregister

func (g GaugeFuncStub) GaugeFuncDeregister()

func (GaugeFuncStub) GaugeFuncRegister

func (g GaugeFuncStub) GaugeFuncRegister(_ func() float64)

type GaugeRegistry

type GaugeRegistry interface {
	Gauge(name string, l Labels) Gauge

	GaugeFunc(name string, l Labels) GaugeFunc
}

type GaugeRegistryStub

type GaugeRegistryStub struct{}

func (GaugeRegistryStub) Gauge

func (g GaugeRegistryStub) Gauge(_ string, _ Labels) Gauge

func (GaugeRegistryStub) GaugeFunc

func (g GaugeRegistryStub) GaugeFunc(_ string, _ Labels) GaugeFunc

type GaugeStub

type GaugeStub struct{}

func (GaugeStub) Set

func (g GaugeStub) Set(_ float64)

type Labels

type Labels map[string]string

func NewLabels

func NewLabels() Labels

func (Labels) Add

func (l Labels) Add(key, value string) Labels

Add returns a new copy of Labels with an additional entry, the key/value this function is called with.

func (Labels) ToMap

func (l Labels) ToMap() map[string]string

type MetricsRepository

type MetricsRepository interface {
	CountRegistry
	GaugeRegistry
}

func GetGlobalMetricsRepository

func GetGlobalMetricsRepository() MetricsRepository

type MetricsRepositoryStub

type MetricsRepositoryStub struct {
	CountRegistryStub
	GaugeRegistryStub
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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