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

This commit is contained in:
TsMask committed 2024-05-18 17:20:48 +08:00
commit 32c8b72712
2 files changed
+17 -13

No files matched your search

+9
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)