metrics

package
v0.0.0-rc2 Latest Latest
Warning

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

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

Documentation

Overview

Package metrics provides interface collecting performance metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buckets

type Buckets interface {
	// Size returns number of buckets.
	Size() int

	// MapValue returns index of the bucket.
	//
	// Index is integer in range [0, Size()).
	MapValue(v float64) int

	// UpperBound of the last bucket is always +Inf.
	//
	// bucketIndex is integer in range [0, Size()-1).
	UpperBound(bucketIndex int) float64
}

Buckets defines intervals of the regular histogram.

func MakeExponentialBuckets

func MakeExponentialBuckets(start, factor float64, n int) Buckets

MakeExponentialBuckets creates a set of exponential value buckets.

func MakeLinearBuckets

func MakeLinearBuckets(start, width float64, n int) Buckets

MakeLinearBuckets creates a set of linear value buckets.

func NewBuckets

func NewBuckets(bk ...float64) Buckets

NewBuckets returns new Buckets implementation.

type CollectPolicy

type CollectPolicy interface {
	RegisteredCounter(counterFunc func() int64) func() int64
	RegisteredGauge(gaugeFunc func() float64) func() float64
	AddCollect(collect func(ctx context.Context))
}

CollectPolicy defines how registered gauge metrics are updated via collect func.

type Counter

type Counter interface {
	// Inc increments counter by 1.
	Inc()

	// Add adds delta to the counter. Delta must be >=0.
	Add(delta int64)
}

Counter tracks monotonically increasing value.

type CounterVec

type CounterVec interface {
	With(map[string]string) Counter

	// Reset deletes all metrics in vector.
	Reset()
}

CounterVec stores multiple dynamically created counters.

type DurationBuckets

type DurationBuckets interface {
	// Size returns number of buckets.
	Size() int

	// MapDuration returns index of the bucket.
	//
	// index is integer in range [0, Size()).
	MapDuration(d time.Duration) int

	// UpperBound of the last bucket is always +Inf.
	//
	// bucketIndex is integer in range [0, Size()-1).
	UpperBound(bucketIndex int) time.Duration
}

DurationBuckets defines buckets of the duration histogram.

func MakeExponentialDurationBuckets

func MakeExponentialDurationBuckets(start time.Duration, factor float64, n int) DurationBuckets

MakeExponentialDurationBuckets creates a set of exponential duration buckets.

func MakeLinearDurationBuckets

func MakeLinearDurationBuckets(start, width time.Duration, n int) DurationBuckets

MakeLinearDurationBuckets creates a set of linear duration buckets.

func NewDurationBuckets

func NewDurationBuckets(bk ...time.Duration) DurationBuckets

NewDurationBuckets returns new DurationBuckets implementation.

type FuncCounter

type FuncCounter interface {
	Function() func() int64
}

FuncCounter is Counter with value provided by callback function.

type FuncGauge

type FuncGauge interface {
	Function() func() float64
}

FuncGauge is Gauge with value provided by callback function.

type FuncIntGauge

type FuncIntGauge interface {
	Function() func() int64
}

FuncIntGauge is IntGauge with value provided by callback function.

type Gauge

type Gauge interface {
	Set(value float64)
	Add(value float64)
}

Gauge tracks single float64 value.

type GaugeVec

type GaugeVec interface {
	With(map[string]string) Gauge

	// Reset deletes all metrics in vector.
	Reset()
}

GaugeVec stores multiple dynamically created gauges.

type Histogram

type Histogram interface {
	RecordValue(value float64)
}

Histogram tracks distribution of value.

type HistogramVec

type HistogramVec interface {
	With(map[string]string) Histogram

	// Reset deletes all metrics in vector.
	Reset()
}

HistogramVec stores multiple dynamically created histograms.

type IntGauge

type IntGauge interface {
	Set(value int64)
	Add(value int64)
}

IntGauge tracks single int64 value.

type IntGaugeVec

type IntGaugeVec interface {
	With(map[string]string) IntGauge

	// Reset deletes all metrics in vector.
	Reset()
}

IntGaugeVec stores multiple dynamically created gauges.

type MetricsStreamer

type MetricsStreamer interface {
	Stream(context.Context, io.Writer) (int, error)
}

MetricsStreamer represents a registry that can stream collected metrics data to some destination

type Registry

type Registry interface {
	// WithTags creates new sub-scope, where each metric has tags attached to it.
	WithTags(tags map[string]string) Registry
	// WithPrefix creates new sub-scope, where each metric has prefix added to it name.
	WithPrefix(prefix string) Registry

	ComposeName(parts ...string) string

	Counter(name string) Counter
	CounterVec(name string, labels []string) CounterVec
	FuncCounter(name string, function func() int64) FuncCounter

	Gauge(name string) Gauge
	GaugeVec(name string, labels []string) GaugeVec
	FuncGauge(name string, function func() float64) FuncGauge

	IntGauge(name string) IntGauge
	IntGaugeVec(name string, labels []string) IntGaugeVec
	FuncIntGauge(name string, function func() int64) FuncIntGauge

	Timer(name string) Timer
	TimerVec(name string, labels []string) TimerVec

	Histogram(name string, buckets Buckets) Histogram
	HistogramVec(name string, buckets Buckets, labels []string) HistogramVec

	DurationHistogram(name string, buckets DurationBuckets) Timer
	DurationHistogramVec(name string, buckets DurationBuckets, labels []string) TimerVec
}

Registry creates profiling metrics.

type Timer

type Timer interface {
	RecordDuration(value time.Duration)
}

Timer measures durations.

type TimerVec

type TimerVec interface {
	With(map[string]string) Timer

	// Reset deletes all metrics in vector.
	Reset()
}

TimerVec stores multiple dynamically created timers.

Directories

Path Synopsis
dashboard generator for these metrics can be found at: github.com/doublecloud/transfer/arcadia/library/go/yandex/monitoring-dashboards
dashboard generator for these metrics can be found at: github.com/doublecloud/transfer/arcadia/library/go/yandex/monitoring-dashboards
internal

Jump to

Keyboard shortcuts

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