Skip to content

carousell/gin-prometheus-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gin-prometheus-middleware

Go Gin middleware for Prometheus

Export metrics for request duration request_duration and request count request_count

Example

import (
    gpmiddleware "github.com/carousell/gin-prometheus-middleware"
    "github.com/gin-gonic/gin"
)

func main(){
    r := gin.New()
    
    p := gpmiddleware.NewPrometheus("gin")
    p.Use(r)
    
    r.GET("/", func(c *gin.Context) {
        c.JSON(200, "Hello world! visit /metrics for metrics")
})

    r.Run(":37321")
}