Merge remote-tracking branch 'origin/main' into lichang

This commit is contained in:
TsMask
2024-05-18 17:20:48 +08:00
2 changed files with 17 additions and 13 deletions

View File

@@ -19,7 +19,9 @@ import (
"be.ems/src/modules/trace"
"be.ems/src/modules/ws"
"github.com/chenjiandongx/ginprom"
"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
//go:embed assets/*
@@ -29,6 +31,13 @@ var assetsDir embed.FS
func AppEngine() *gin.Engine {
app := initAppEngine()
// TODO 不建议在主分支中加入
// 性能分析监控
if promEnabled := config.Get("pprof.enabled"); promEnabled != nil && promEnabled.(bool) {
app.Use(ginprom.PromMiddleware(nil))
app.GET("/metrics", ginprom.PromHandler(promhttp.Handler()))
}
// 初始全局默认
initDefeat(app)