metrics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package metrics exposes a Prometheus registry, an HTTP handler to scrape it, and a middleware that records request count and latency. Services register their own collectors on the provided registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Registry *prometheus.Registry
	// contains filtered or unexported fields
}

Metrics bundles a registry with the standard HTTP request collectors.

func New

func New(namespace string) *Metrics

New builds a Metrics with a fresh registry and registers Go runtime and process collectors plus HTTP request collectors.

func (*Metrics) Handler

func (m *Metrics) Handler() http.Handler

Handler returns the scrape handler for /metrics.

func (*Metrics) Middleware

func (m *Metrics) Middleware() func(http.Handler) http.Handler

Middleware records count and latency for each request. routePattern should be the matched route template (low cardinality), not the raw path.

Jump to

Keyboard shortcuts

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