middlewares

package
v0.0.0-...-fb4321b Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TotalRequests = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "http_requests_total",
			Help: "Total number of HTTP requests.",
		},
		[]string{"path"},
	)

	ResponseDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "http_response_duration_seconds",
			Help:    "Histogram of response durations.",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"path"},
	)

	LastRequestTime = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "http_last_request_time_seconds",
			Help: "Timestamp of the last HTTP request received.",
		},
		[]string{"path"},
	)

	StatusCodeCounts = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "http_status_code_counts",
			Help: "Counts of HTTP status codes.",
		},
		[]string{"path", "status"},
	)
)

Functions

func AuthMiddleware

func AuthMiddleware() gin.HandlerFunc

func LoggerMiddleware

func LoggerMiddleware() gin.HandlerFunc

The`LoggerMiddleware` function -------------------------------------------------------- returns a Gin `Handler Function` that measures the request time, and Logs basic information about the request

func PrometheusMiddleware

func PrometheusMiddleware() gin.HandlerFunc

func RegisterMiddlewares

func RegisterMiddlewares(router *gin.Engine)

Types

This section is empty.

Jump to

Keyboard shortcuts

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