Awesome Open Source
Awesome Open Source

Gin's middleware for request stats

Build Status codecov Go Report Card GoDoc

Lightweight Gin's middleware for request metrics

Usage

Start using it

Download and install it:

$ go get github.com/semihalev/gin-stats
import "github.com/semihalev/gin-stats"

Example usage:

package main

import (
	"fmt"
	"time"

	"github.com/gin-gonic/gin"
	"github.com/semihalev/gin-stats"    
)

func main() {
	r := gin.Default()
	r.Use(stats.RequestStats())
    
	r.GET("/stats", func(c *gin.Context) {
		c.JSON(http.StatusOK, stats.Report())
	})

	// Listen and Server in 0.0.0.0:8080
	r.Run(":8080")
}


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
go (15,124
middleware (354
metrics (346
gin (88
stats (78
gin-gonic (18