metrics

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package metrics provides Prometheus HTTP instrumentation for Gin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler() gin.HandlerFunc

Handler returns a Gin handler that serves Prometheus metrics in the text exposition format.

Types

type Metrics

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

Metrics holds Prometheus collectors for HTTP instrumentation.

func New

func New() *Metrics

New creates a Metrics instance and registers collectors with the default Prometheus registry.

func (*Metrics) Middleware

func (m *Metrics) Middleware() gin.HandlerFunc

Middleware returns a Gin middleware that records request count, duration, and response size for every HTTP request.

Jump to

Keyboard shortcuts

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