添加基础性能测试分析代码
This commit is contained in:
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"proxy-server/pkg/utils"
|
||||
@@ -17,6 +18,8 @@ import (
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
import _ "net/http/pprof"
|
||||
|
||||
type Context struct {
|
||||
context.Context
|
||||
log *slog.Logger
|
||||
@@ -34,6 +37,14 @@ func Start() {
|
||||
env.Init()
|
||||
orm.Init()
|
||||
|
||||
// 性能监控
|
||||
go func() {
|
||||
err := http.ListenAndServe(":6060", nil)
|
||||
if err != nil {
|
||||
slog.Error("性能监控服务发生错误", "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
// 退出信号
|
||||
osQuit := make(chan os.Signal)
|
||||
signal.Notify(osQuit, os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
Reference in New Issue
Block a user