added prometheus metrics
All checks were successful
/ Make image (push) Successful in 1m18s

This commit is contained in:
nquidox 2026-02-16 20:09:22 +03:00
parent 88b1e03d00
commit 35944371f7
3 changed files with 8 additions and 0 deletions

View file

@ -47,6 +47,7 @@ func NewApp(deps Deps) *App {
} }
app.router = app.routerHandler.Set() app.router = app.routerHandler.Set()
app.routerHandler.EnableMetrics()
apiRoutes := app.router.Group(app.apiPrefix) apiRoutes := app.router.Group(app.apiPrefix)
apiRoutes.GET("/", func(c *gin.Context) { apiRoutes.GET("/", func(c *gin.Context) {

View file

@ -8,4 +8,5 @@ type Router interface {
Set() *gin.Engine Set() *gin.Engine
AuthMW() gin.HandlerFunc AuthMW() gin.HandlerFunc
RefreshMW() gin.HandlerFunc RefreshMW() gin.HandlerFunc
EnableMetrics()
} }

View file

@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
swaggerFiles "github.com/swaggo/files" swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger" ginSwagger "github.com/swaggo/gin-swagger"
ginprometheus "github.com/zsais/go-gin-prometheus"
"merch-parser-api/internal/interfaces" "merch-parser-api/internal/interfaces"
"net/http" "net/http"
"time" "time"
@ -73,3 +74,8 @@ func (r *router) Set() *gin.Engine {
return r.engine return r.engine
} }
func (r *router) EnableMetrics() {
p := ginprometheus.NewPrometheus("gin")
p.Use(r.engine)
}