Install pprof

This commit is contained in:
rxdn 2022-07-12 14:07:34 +01:00
parent abb6d001ff
commit 80bfadc3c1
3 changed files with 19 additions and 6 deletions

View File

@ -4,7 +4,7 @@ import (
crypto_rand "crypto/rand" crypto_rand "crypto/rand"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/TicketsBot/GoPanel/app/http" app "github.com/TicketsBot/GoPanel/app/http"
"github.com/TicketsBot/GoPanel/app/http/endpoints/root" "github.com/TicketsBot/GoPanel/app/http/endpoints/root"
"github.com/TicketsBot/GoPanel/config" "github.com/TicketsBot/GoPanel/config"
"github.com/TicketsBot/GoPanel/database" "github.com/TicketsBot/GoPanel/database"
@ -20,6 +20,8 @@ import (
"github.com/getsentry/sentry-go" "github.com/getsentry/sentry-go"
"github.com/rxdn/gdl/rest/request" "github.com/rxdn/gdl/rest/request"
"math/rand" "math/rand"
"net/http"
"net/http/pprof"
"time" "time"
) )
@ -33,6 +35,8 @@ func main() {
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
} }
startPprof()
config.LoadConfig() config.LoadConfig()
sentryOpts := sentry.ClientOptions{ sentryOpts := sentry.ClientOptions{
@ -74,7 +78,7 @@ func main() {
rpc.PremiumClient = &c rpc.PremiumClient = &c
} }
http.StartServer() app.StartServer()
} }
func ListenChat(client redis.RedisClient) { func ListenChat(client redis.RedisClient) {
@ -93,3 +97,14 @@ func ListenChat(client redis.RedisClient) {
root.SocketsLock.RUnlock() root.SocketsLock.RUnlock()
} }
} }
func startPprof() {
mux := http.NewServeMux()
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/{action}", pprof.Index)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
go func() {
http.ListenAndServe(":6060", mux)
}()
}

View File

@ -314,8 +314,8 @@
teams: [], teams: [],
button_style: "1", button_style: "1",
form_id: "null", form_id: "null",
channel_id: channels.find((c) => c.type === 0).id, channel_id: channels.find((c) => c.type === 0)?.id,
category_id: channels.find((c) => c.type === 4).id, category_id: channels.find((c) => c.type === 4)?.id,
use_server_default_naming_scheme: true, use_server_default_naming_scheme: true,
}; };
} else { } else {

2
go.sum
View File

@ -5,8 +5,6 @@ github.com/TicketsBot/archiverclient v0.0.0-20220326163414-558fd52746dc h1:n15W8
github.com/TicketsBot/archiverclient v0.0.0-20220326163414-558fd52746dc/go.mod h1:2KcfHS0JnSsgcxZBs3NyWMXNQzEo67mBSGOyzHPWOCc= github.com/TicketsBot/archiverclient v0.0.0-20220326163414-558fd52746dc/go.mod h1:2KcfHS0JnSsgcxZBs3NyWMXNQzEo67mBSGOyzHPWOCc=
github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42 h1:3/qnbrEfL8gqSbjJ4o7WKkdoPngmhjAGEXFwteEjpqs= github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42 h1:3/qnbrEfL8gqSbjJ4o7WKkdoPngmhjAGEXFwteEjpqs=
github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42/go.mod h1:WxHh6bY7KhIqdayeOp5f0Zj2NNi/7QqCQfMEqHnpdAM= github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42/go.mod h1:WxHh6bY7KhIqdayeOp5f0Zj2NNi/7QqCQfMEqHnpdAM=
github.com/TicketsBot/database v0.0.0-20220710120946-a97157c1ca8c h1:WD3W0cUkIpMI5XUoGDQ88uYJnljZXxqv0e9TWCt6MqI=
github.com/TicketsBot/database v0.0.0-20220710120946-a97157c1ca8c/go.mod h1:F57cywrZsnper1cy56Bx0c/HEsxQBLHz3Pl98WXblWw=
github.com/TicketsBot/database v0.0.0-20220710122820-0fdcde6692f0 h1:1lrgdlmyf0KFkl4Y3Cu1L6BQzKOzowoLUp/Kq/jwfvc= github.com/TicketsBot/database v0.0.0-20220710122820-0fdcde6692f0 h1:1lrgdlmyf0KFkl4Y3Cu1L6BQzKOzowoLUp/Kq/jwfvc=
github.com/TicketsBot/database v0.0.0-20220710122820-0fdcde6692f0/go.mod h1:F57cywrZsnper1cy56Bx0c/HEsxQBLHz3Pl98WXblWw= github.com/TicketsBot/database v0.0.0-20220710122820-0fdcde6692f0/go.mod h1:F57cywrZsnper1cy56Bx0c/HEsxQBLHz3Pl98WXblWw=
github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c h1:OqGjFH6mbE6gd+NqI2ARJdtH3UUvhiAkD0r0fhGJK2s= github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c h1:OqGjFH6mbE6gd+NqI2ARJdtH3UUvhiAkD0r0fhGJK2s=