meter

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package meter provides a simple meter system for metrics. The metrics are aggregated by the meter provider.

Index

Constants

This section is empty.

Variables

View Source
var DefBuckets = Buckets{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}

DefBuckets is the default buckets for histograms.

Functions

This section is empty.

Types

type Buckets

type Buckets []float64

Buckets is a slice of bucket boundaries.

type Counter

type Counter interface {
	Instrument
	Inc(delta float64, labelValues ...string)
}

Counter is a metric that represents a single numerical value that only ever goes up.

type Gauge

type Gauge interface {
	Instrument
	Set(value float64, labelValues ...string)
	Add(delta float64, labelValues ...string)
}

Gauge is a metric that represents a single numerical value that can arbitrarily go up and down.

type HierarchicalScope

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

HierarchicalScope is a Scope implementation that supports hierarchical scopes.

func (*HierarchicalScope) ConstLabels

func (s *HierarchicalScope) ConstLabels(labels LabelPairs) Scope

ConstLabels merges the given labels with the labels of the parent scope.

func (*HierarchicalScope) GetLabels

func (s *HierarchicalScope) GetLabels() LabelPairs

GetLabels returns the labels of this scope.

func (*HierarchicalScope) GetNamespace

func (s *HierarchicalScope) GetNamespace() string

GetNamespace returns the namespace of this scope.

func (*HierarchicalScope) SubScope

func (s *HierarchicalScope) SubScope(name string) Scope

SubScope creates a new sub-scope with the given name.

type Histogram

type Histogram interface {
	Instrument
	Observe(value float64, labelValues ...string)
}

Histogram is a metric that represents the statistical distribution of a set of values.

type Instrument

type Instrument interface {
	// Delete the metric with the given label values.
	Delete(labelValues ...string) bool
}

Instrument is the interface for a metric.

type LabelPairs

type LabelPairs map[string]string

LabelPairs is a map of label names to label values, which is used to identify a metric.

func ToLabelPairs added in v0.7.0

func ToLabelPairs(labelNames, labelValues []string) LabelPairs

ToLabelPairs converts the given label names and label values to a map of label names to label values.

func (LabelPairs) Merge

func (p LabelPairs) Merge(other LabelPairs) LabelPairs

Merge merges the given label pairs with the current label pairs.

type Provider

type Provider interface {
	Counter(name string, labelNames ...string) Counter
	Gauge(name string, labelNames ...string) Gauge
	Histogram(name string, buckets Buckets, labelNames ...string) Histogram
}

Provider is the interface for a metrics provider, which is responsible for creating metrics.

type Scope

type Scope interface {
	ConstLabels(labels LabelPairs) Scope
	SubScope(name string) Scope
	GetNamespace() string
	GetLabels() LabelPairs
}

Scope is a namespace wrapper for metrics.

func NewHierarchicalScope

func NewHierarchicalScope(name, sep string) Scope

NewHierarchicalScope creates a new hierarchical scope.

Directories

Path Synopsis
Package native provides a simple meter system for metrics.
Package native provides a simple meter system for metrics.
Package prom provides a prometheus implementation for the meter system.
Package prom provides a prometheus implementation for the meter system.

Jump to

Keyboard shortcuts

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