metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package metrics provides Prometheus request metrics for Fiber apps: a middleware that records request count and latency, and a handler that serves the Prometheus exposition format. It is a thin wrapper over prometheus/client_golang's default registry (which also exposes the standard Go-runtime and process collectors).

Index

Constants

View Source
const MetricsPath = "/metrics"

MetricsPath is the conventional scrape path. Middleware skips it so scrapes are not self-counted.

Variables

This section is empty.

Functions

func Handler

func Handler() fiber.Handler

Handler serves the Prometheus exposition format (default registry) as a Fiber handler.

func Middleware

func Middleware(opts ...Option) fiber.Handler

Middleware returns a Fiber handler that records request count and duration, labeled by method, route template (e.g. "/items/:id"), and status.

Types

type Option

type Option func(*config)

Option configures the metrics middleware.

func WithNamespace

func WithNamespace(ns string) Option

WithNamespace prefixes all metric names with namespace + "_". Because the metric vectors are registered once (on the first Middleware call), the namespace is captured from that first call and fixed thereafter.

Jump to

Keyboard shortcuts

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