httptelemetry

package
v1.99.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package httptelemetry provides generic, Prometheus-native HTTP server metrics for any service in this repo. Named httptelemetry, not http, so callers don't need to alias it against net/http.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router added in v1.86.1

type Router interface {
	// Route returns the pattern that serves r, or "" when none does.
	Route(r *http.Request) string
}

Router is a handler that routes further, such as one dispatching to several muxes behind a catch-all pattern. Middleware labels a request by the pattern Route reports, not by the outer pattern that only led there.

type ServerMetrics

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

ServerMetrics holds the registered instruments Middleware records into. Names, buckets and the code/method labels match LabKit v1's metrics.NewHandlerFactory, so the series carry over if LabKit takes this on. promhttp supplies status and method; only the route label is ours.

func NewServerMetrics

func NewServerMetrics(reg prometheus.Registerer) (*ServerMetrics, error)

NewServerMetrics builds and registers HTTP server metrics into reg.

func (*ServerMetrics) Middleware

func (m *ServerMetrics) Middleware(mux *http.ServeMux) func(http.Handler) http.Handler

Middleware records every request that reaches next, labelled by the mux pattern it would match: a pattern is bounded, a request path is not.

Jump to

Keyboard shortcuts

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