add metrics

This commit is contained in:
2023-10-24 00:52:20 +08:00
parent 536540335d
commit fd61e49759
3 changed files with 481 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/penglongli/gin-metrics/ginmetrics"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
@@ -78,6 +79,11 @@ func main() {
// init gin
engine := gin.Default()
// metrics
m := ginmetrics.GetMonitor()
// m.SetMetricPath("/debug/metrics")
m.Use(engine)
// error handle middleware
engine.Use(func(c *gin.Context) {
c.Next()