diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-07-21 16:28:43 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-07-21 16:28:43 +0300 |
| commit | 171230a9ded7901efdd44b575b6facf67678be2d (patch) | |
| tree | 95dc2d25de538e4547b032065d1877d7408cb431 /cmd/server | |
| parent | 6ed8ee90c2dfc4fb1bc7fa8cc038fa7352821166 (diff) | |
Added pyroscope support, experimental
Diffstat (limited to 'cmd/server')
| -rw-r--r-- | cmd/server/main.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go index d1539fb..147670e 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -29,6 +29,10 @@ import ( "syscall" "time" + "github.com/grafana/pyroscope-go" + _ "github.com/grafana/pyroscope-go/godeltaprof/http/pprof" + _ "net/http/pprof" + "github.com/kyren223/eko/embeds" "github.com/kyren223/eko/internal/server" "github.com/kyren223/eko/internal/server/api" @@ -69,6 +73,8 @@ func main() { handleReload() handleShutdown(cancel) + startPyroscopeProfiling() + if ok := reloadTosAndPrivacy(); !ok { return } @@ -219,3 +225,25 @@ func reloadTosAndPrivacy() bool { return true } + +func startPyroscopeProfiling() { + pyroscope.Start(pyroscope.Config{ + ApplicationName: "eko", + ServerAddress: "http://localhost:4040", + Logger: pyroscope.StandardLogger, // nil to disable + // by default all profilers are enabled, + // but you can select the ones you want to use: + ProfileTypes: []pyroscope.ProfileType{ + pyroscope.ProfileCPU, + pyroscope.ProfileAllocObjects, + pyroscope.ProfileAllocSpace, + pyroscope.ProfileInuseObjects, + pyroscope.ProfileInuseSpace, + pyroscope.ProfileGoroutines, + pyroscope.ProfileMutexCount, + pyroscope.ProfileMutexCount, + pyroscope.ProfileBlockCount, + pyroscope.ProfileBlockDuration, + }, + }) +} |
