metric

package
v0.0.0-...-31c1c1e Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetrics

func NewMetrics() *metrics

Types

type Collector

type Collector interface {
	Prefix() string
	Describe() []*Description
	Collect() Metrics
	Stop()
}

type Description

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

func NewDesc

func NewDesc(name, description string, labels []string) *Description

func (*Description) Description

func (d *Description) Description() string

func (*Description) Name

func (d *Description) Name() string

type Metrics

type Metrics interface {
	Value(name string, labels ...string) Value
	Values(name string, labels ...string) []Value
	Labels(name string, label string) []string
	All() []Value
	Add(v Value)
	String() string
}

type Pattern

type Pattern interface {
	// Name returns the name of the metric this pattern is designated to.
	Name() string

	// Match returns whether a map of labels with its label values
	// match this pattern.
	Match(labels map[string]string) bool

	// IsValid returns whether the pattern is valid.
	IsValid() bool
}

func NewPattern

func NewPattern(name string, labels ...string) Pattern

NewPattern creates a new pattern with the given prefix and group name. There has to be an even number of parameter, which is ("label", "labelvalue", "label", "labelvalue" ...). The label value will be interpreted as regular expression.

type Reader

type Reader interface {
	Collect([]Pattern) Metrics
}

type Value

type Value interface {
	Name() string
	Val() float64
	L(name string) string
	Labels() map[string]string
	Match(patterns []Pattern) bool
	Hash() string
	String() string
}

func NewValue

func NewValue(description *Description, v float64, elms ...string) Value

Jump to

Keyboard shortcuts

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