registry

package
v0.0.0-...-6b0088a Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Overview

Package registry holds a map of all metrics registered by the process.

This map is global and it is populated during init() time, when individual metrics are defined.

Index

Constants

This section is empty.

Variables

View Source
var (
	Global = NewRegistry()
)

Functions

func ValidateMetricFieldName

func ValidateMetricFieldName(fName string) error

ValidateMetricFieldName validates a metric field name.

func ValidateMetricName

func ValidateMetricName(name string) error

ValidateMetricName validates the provided metric name. * if the provided name starts with "/", validate it as is; * otherwise prepend monitor.MetricNamePrefix to it then validate.

Types

type Registry

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

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new registry.

func (*Registry) Add

func (registry *Registry) Add(m types.Metric)

Add adds a metric to the metric registry.

Panics if - the metric name is invalid. - a metric with the same name and target type is defined already. - a field name is invalid.

func (*Registry) Iter

func (registry *Registry) Iter(cb func(m types.Metric))

Iter calls a callback for each registered metric.

Metrics are visited in no particular order. The callback must not modify the registry.

Jump to

Keyboard shortcuts

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