metrics

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 0 Imported by: 1 module, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metrics defines a Prometheus-style metrics abstraction for exposing gauges, counters, and observers (histograms/summaries).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter interface {
	Inc()
	Add(float64)
}

Counter is a metric that represents a monotonically increasing value.

type Gauge

type Gauge interface {
	Inc()
	Dec()
	Add(float64)
	Set(float64)
}

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

type Labels

type Labels map[string]string

Labels is a set of label key-value pairs attached to a metric instance.

type MetricName

type MetricName string

MetricName is a unique name identifying a metric.

type Metrics

type Metrics interface {
	// Counter returns a Counter with the given name and labels.
	Counter(name MetricName, labels Labels) Counter
	// Gauge returns a Gauge with the given name and labels.
	Gauge(name MetricName, labels Labels) Gauge
	// Observer returns an Observer with the given name and labels.
	Observer(name MetricName, labels Labels) Observer
}

Metrics is the top-level metrics factory. It creates or retrieves metric instances by name and labels, following the Prometheus pattern where label sets produce unique metric instances.

type Observer

type Observer interface {
	Observe(float64)
}

Observer is a metric that observes values for distribution statistics (e.g. histograms or summaries).

Jump to

Keyboard shortcuts

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