fix: systemname

This commit is contained in:
Seefs
2025-12-19 22:27:35 +08:00
parent fcafadc6bb
commit 1168ddf9f9

View File

@@ -1,7 +1,6 @@
package common
import (
"os"
"runtime"
"github.com/grafana/pyroscope-go"
@@ -9,18 +8,20 @@ import (
func StartPyroScope() error {
pyroscopeUrl := os.Getenv("PYROSCOPE_URL")
pyroscopeUrl := GetEnvOrDefaultString("PYROSCOPE_URL", "")
if pyroscopeUrl == "" {
return nil
}
pyroscopeAppName := GetEnvOrDefaultString("PYROSCOPE_APP_NAME", "new-api")
// These 2 lines are only required if you're using mutex or block profiling
// Read the explanation below for how to set these rates:
runtime.SetMutexProfileFraction(5)
runtime.SetBlockProfileRate(5)
_, err := pyroscope.Start(pyroscope.Config{
ApplicationName: SystemName,
ApplicationName: pyroscopeAppName,
ServerAddress: pyroscopeUrl,