meter

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 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 (LabelPairs) Merge

func (p LabelPairs) Merge(other LabelPairs) LabelPairs

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

type NoopProvider

type NoopProvider struct{}

NoopProvider is a no-op implementation of the Provider interface.

func (NoopProvider) Counter

func (NoopProvider) Counter(_ string, _ ...string) Counter

Counter returns a no-op implementation of the Counter interface.

func (NoopProvider) Gauge

func (NoopProvider) Gauge(_ string, _ ...string) Gauge

Gauge returns a no-op implementation of the Gauge interface.

func (NoopProvider) Histogram

func (NoopProvider) Histogram(_ string, _ Buckets, _ ...string) Histogram

Histogram returns a no-op implementation of the Histogram interface.

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 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