Skip to content

Commit

Permalink
Merge pull request spidernet-io#3223 from Icarus9913/feat/wk/pyroscope
Browse files Browse the repository at this point in the history
supplement pyroscope profile types
  • Loading branch information
cyclinder authored Feb 21, 2024
2 parents 51d17d7 + 466513b commit 513902b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions cmd/spiderpool-agent/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func DaemonMain() {
if e != nil || len(node) == 0 {
logger.Sugar().Fatalf("Failed to get hostname: %v", e)
}

// These 2 lines are only required if you're using mutex or block profiling
runtime.SetMutexProfileFraction(5)
runtime.SetBlockProfileRate(5)
_, e = pyroscope.Start(pyroscope.Config{
ApplicationName: binNameAgent,
ServerAddress: agentContext.Cfg.PyroscopeAddress,
Expand All @@ -105,6 +109,12 @@ func DaemonMain() {
pyroscope.ProfileAllocSpace,
pyroscope.ProfileInuseObjects,
pyroscope.ProfileInuseSpace,
// additional
pyroscope.ProfileGoroutines,
pyroscope.ProfileMutexCount,
pyroscope.ProfileMutexDuration,
pyroscope.ProfileBlockCount,
pyroscope.ProfileBlockDuration,
},
})
if e != nil {
Expand Down
10 changes: 10 additions & 0 deletions cmd/spiderpool-controller/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ func DaemonMain() {
if e != nil || len(node) == 0 {
logger.Sugar().Fatalf("Failed to get hostname: %v", e)
}

// These 2 lines are only required if you're using mutex or block profiling
runtime.SetMutexProfileFraction(5)
runtime.SetBlockProfileRate(5)
_, e = pyroscope.Start(pyroscope.Config{
ApplicationName: binNameController,
ServerAddress: controllerContext.Cfg.PyroscopeAddress,
Expand All @@ -109,6 +113,12 @@ func DaemonMain() {
pyroscope.ProfileAllocSpace,
pyroscope.ProfileInuseObjects,
pyroscope.ProfileInuseSpace,
// additional
pyroscope.ProfileGoroutines,
pyroscope.ProfileMutexCount,
pyroscope.ProfileMutexDuration,
pyroscope.ProfileBlockCount,
pyroscope.ProfileBlockDuration,
},
})
if e != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ endif
USE_TLS_METHOD := auto

ifeq ($(E2E_CHINA_IMAGE_REGISTRY),true)
IMAGE_PYROSCOPE_NAME ?= docker.m.daocloud.io/pyroscope/pyroscope:latest
IMAGE_PYROSCOPE_NAME ?= docker.m.daocloud.io/grafana/pyroscope:latest
else
IMAGE_PYROSCOPE_NAME ?= docker.io/pyroscope/pyroscope:latest
IMAGE_PYROSCOPE_NAME ?= docker.io/grafana/pyroscope:latest
endif


Expand Down

0 comments on commit 513902b

Please sign in to comment.