metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Labels

type Labels map[string]string

Labels is a simple key:value map for metric dimensions.

type MetricsRecorder

type MetricsRecorder interface {
	IncCounter(name string, labels Labels)
	ObserveHistogram(name string, value float64, labels Labels)
}

MetricsRecorder captures counters and histograms.

type Middleware

type Middleware struct {
	M MetricsRecorder
}

Middleware instruments HTTP traffic using a provided recorder.

func New

New constructs a metrics middleware.

func (*Middleware) Handler

func (mw *Middleware) Handler(next http.Handler) http.Handler

Handler wraps the next handler to record counters and duration.

type NoopMetrics

type NoopMetrics struct{}

NoopMetrics is the default. Swap later for Prometheus, etc.

func (NoopMetrics) IncCounter

func (NoopMetrics) IncCounter(_ string, _ Labels)

func (NoopMetrics) ObserveHistogram

func (NoopMetrics) ObserveHistogram(_ string, _ float64, _ Labels)

Jump to

Keyboard shortcuts

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