metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NonNegativeBuckets = []float64{
	10, 20, 50,
	100, 200, 500,
	1000, 2000, 5000,
	10000, 20000, 50000,
	100000, 200000, 500000,
	1000000, 2000000, 5000000,
	10000000, 20000000, 50000000,
	100000000, 200000000, 500000000,
	1000000000, 2000000000, 5000000000,
	10000000000, 20000000000, 50000000000,
	100000000000, 200000000000, 500000000000,
	1000000000000, 2000000000000, 5000000000000,
	10000000000000, 20000000000000, 50000000000000,
	100000000000000, 200000000000000, 500000000000000,
	1000000000000000, 2000000000000000, 5000000000000000,
	10000000000000000, 20000000000000000, 50000000000000000,
	100000000000000000, 200000000000000000, 500000000000000000,
	1000000000000000000, 2000000000000000000, 5000000000000000000,
	10000000000000000000, 20000000000000000000, 50000000000000000000,
}

Functions

This section is empty.

Types

type Counter

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

func NewCounter

func NewCounter(name string) *Counter

func (*Counter) Add

func (c *Counter) Add(delta float64)

func (*Counter) Inc

func (c *Counter) Inc()

func (*Counter) Name

func (c *Counter) Name() string

type CounterMap

type CounterMap[L comparable] struct {
	// contains filtered or unexported fields
}

func NewCounterMap

func NewCounterMap[L comparable](name string) *CounterMap[L]

func (*CounterMap[L]) Get

func (cm *CounterMap[L]) Get(labels L) *Counter

func (*CounterMap[L]) Name

func (cm *CounterMap[L]) Name() string

type Gauge

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

func NewGauge

func NewGauge(name string) *Gauge

func (*Gauge) Add

func (g *Gauge) Add(delta float64)

func (*Gauge) Name

func (g *Gauge) Name() string

func (*Gauge) Set

func (g *Gauge) Set(val float64)

func (*Gauge) Sub

func (g *Gauge) Sub(delta float64)

type GaugeMap

type GaugeMap[L comparable] struct {
	// contains filtered or unexported fields
}

func NewGaugeMap

func NewGaugeMap[L comparable](name string) *GaugeMap[L]

func (*GaugeMap[L]) Get

func (gm *GaugeMap[L]) Get(labels L) *Gauge

func (*GaugeMap[L]) Name

func (gm *GaugeMap[L]) Name() string

type Histogram

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

func NewHistogram

func NewHistogram(name string, bounds []float64) *Histogram

func (*Histogram) Name

func (h *Histogram) Name() string

func (*Histogram) Put

func (h *Histogram) Put(val float64)

type HistogramMap

type HistogramMap[L comparable] struct {
	// contains filtered or unexported fields
}

func NewHistogramMap

func NewHistogramMap[L comparable](name string, bounds []float64) *HistogramMap[L]

func (*HistogramMap[L]) Get

func (gm *HistogramMap[L]) Get(labels L) *Histogram

func (*HistogramMap[L]) Name

func (gm *HistogramMap[L]) Name() string

type Metric

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

func NewMetric

func NewMetric(name string) *Metric

func Register

func Register(typ MetricType, name string, bounds []float64) *Metric

func (*Metric) Add

func (m *Metric) Add(delta float64)

func (*Metric) Inc

func (m *Metric) Inc()

func (*Metric) Name

func (m *Metric) Name() string

func (*Metric) Put

func (m *Metric) Put(val float64)

func (*Metric) Set

func (m *Metric) Set(val float64)

func (*Metric) Snapshot

func (m *Metric) Snapshot() *MetricSnapshot

Snapshot 获取metric的快照

func (*Metric) Sub

func (m *Metric) Sub(delta float64)

type MetricMap

type MetricMap[L comparable] struct {
	// contains filtered or unexported fields
}

MetricMap 相同 name 和 label 格式但具体 label 的值不同的 metric 合集

func RegisterMap

func RegisterMap[L comparable](typ MetricType, name string, bounds []float64) *MetricMap[L]

func (*MetricMap[L]) Get

func (mm *MetricMap[L]) Get(labels L) *Metric

Get 通过具体的labels值获取一个指定name和labels格式的metric

func (*MetricMap[L]) Name

func (mm *MetricMap[L]) Name() string

type MetricSnapshot

type MetricSnapshot struct {
	Id     uint64
	Name   string
	Typ    MetricType
	Labels map[string]string

	Value  float64
	Bounds []float64
	Counts []uint64
}

func Snapshot

func Snapshot() []*MetricSnapshot

func (*MetricSnapshot) Clone

func (m *MetricSnapshot) Clone() *MetricSnapshot

type MetricType

type MetricType int32
const (
	MetricTypeInvalid MetricType = iota
	MetricTypeCounter
	MetricTypeGauge
	MetricTypeHistogram
)

Jump to

Keyboard shortcuts

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