metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 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 is a small registry of counters and histograms that can be scraped in the Prometheus text format. It exists so the server needs no metrics dependency for the handful of series it exposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry holds the server's metrics. A nil *Registry is valid and records nothing, so callers need not check whether metrics are switched on.

func New

func New() *Registry

New returns an empty registry.

func (*Registry) Handler

func (r *Registry) Handler() http.Handler

Handler serves the metrics in the Prometheus text exposition format.

func (*Registry) Inc

func (r *Registry) Inc(name, help string, labels ...string)

Inc adds one to a counter.

func (*Registry) Observe

func (r *Registry) Observe(name, help string, seconds float64, labels ...string)

Observe records one duration, in seconds, in a histogram.

Jump to

Keyboard shortcuts

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