metrics

package
v0.0.0-...-070373f Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MonitorPeriod = time.Second * 30

Variables

This section is empty.

Functions

func NewMock

func NewMock(clock clock.Clock) (Client, *Mock)

func NewMonitor

func NewMonitor[T Tags](client Client, tags T, getter func() float64)

Types

type AnyMetric

type AnyMetric interface {
	MetricType() reflect.Type
	MetricImpl() MetricImpl
}

type Client

type Client interface {
	// contains filtered or unexported methods
}

type Impl

type Impl interface {
	New(name string, tagNames []string) MetricImpl
}

type LabeledError

type LabeledError interface {
	error
}

func LabelError

func LabelError(err error, value string) LabeledError

func MakeLabeledError

func MakeLabeledError(value string) LabeledError

type Metric

type Metric[T Tags] struct {
	// contains filtered or unexported fields
}

func New

func New[T Tags](client Client) *Metric[T]

func (*Metric[T]) Construct

func (gm *Metric[T]) Construct(values []reflect.Value) error

func (*Metric[T]) DeferCount

func (metric *Metric[T]) DeferCount(start time.Time, tags T)

func (*Metric[T]) ImplementsGenericUtilMarker

func (*Metric[T]) ImplementsGenericUtilMarker()

func (*Metric[T]) MetricImpl

func (gm *Metric[T]) MetricImpl() MetricImpl

func (*Metric[T]) MetricType

func (*Metric[T]) MetricType() reflect.Type

func (*Metric[T]) UtilReqs

func (*Metric[T]) UtilReqs() []reflect.Type

func (*Metric[T]) With

func (metric *Metric[T]) With(tags T) TaggedMetric

type MetricImpl

type MetricImpl interface {
	Count(value float64, tags []string)
	Histogram(value float64, tags []string)
	Summary(value float64, tags []string)
	Gauge(value float64, tags []string)
	Defer(start time.Time, tags []string)
}

func NewDynamic

func NewDynamic(client Client, name string, tagNames []string) MetricImpl

type Mock

type Mock struct {
	manager.MuxImplBase
	manager.BaseComponent
	// contains filtered or unexported fields
}

func (*Mock) Get

func (mock *Mock) Get(name string, tags map[string]string) *MockEntry

func (*Mock) MuxImplName

func (mock *Mock) MuxImplName() (name string, isDefault bool)

func (*Mock) New

func (mock *Mock) New(name string, tagNames []string) MetricImpl

func (*Mock) PrintAll

func (mock *Mock) PrintAll() string

type MockEntry

type MockEntry struct {
	Int  float64
	Hist []float64
	// contains filtered or unexported fields
}

func (*MockEntry) GetIntUnsafe

func (mi *MockEntry) GetIntUnsafe() float64

Returns the scalar value, or 0 if the receiver is nil. Since this function is only used for assertions after running a test, the mutex is not locked.

type TaggedMetric

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

func (TaggedMetric) Count

func (metric TaggedMetric) Count(value float64)

func (TaggedMetric) Defer

func (metric TaggedMetric) Defer(start time.Time)

func (TaggedMetric) DeferCount

func (metric TaggedMetric) DeferCount(start time.Time)

func (TaggedMetric) Gauge

func (metric TaggedMetric) Gauge(value float64)

func (TaggedMetric) Histogram

func (metric TaggedMetric) Histogram(value float64)

func (TaggedMetric) Summary

func (metric TaggedMetric) Summary(value float64)

type Tags

type Tags interface {
	MetricName() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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