internal/debug: fix some minor issues in file pyroscope.go

This commit is contained in:
Daniel Liu 2026-01-23 15:51:16 +08:00
parent 251b863107
commit 1aa37c2ff1

View file

@ -47,8 +47,9 @@ var (
} }
pyroscopeAuthPasswordFlag = &cli.StringFlag{ pyroscopeAuthPasswordFlag = &cli.StringFlag{
Name: "pyroscope.password", Name: "pyroscope.password",
Usage: "Pyroscope basic authentication password", Usage: "Pyroscope basic authentication password (prefer setting PYROSCOPE_PASSWORD env var instead of CLI flag)",
Value: "", Value: "",
EnvVars: []string{"PYROSCOPE_PASSWORD"},
Category: flags.LoggingCategory, Category: flags.LoggingCategory,
} }
pyroscopeTagsFlag = &cli.StringFlag{ pyroscopeTagsFlag = &cli.StringFlag{
@ -74,7 +75,11 @@ func startPyroscope(ctx *cli.Context) error {
if tag == "" { if tag == "" {
continue continue
} }
k, v, _ := strings.Cut(tag, "=") k, v, ok := strings.Cut(tag, "=")
if !ok || k == "" {
// Skip tags that do not conform to the expected key=value format
continue
}
tags[k] = v tags[k] = v
} }
@ -105,7 +110,7 @@ func startPyroscope(ctx *cli.Context) error {
return err return err
} }
pyroscopeProfiler = profiler pyroscopeProfiler = profiler
log.Info("Enabled Pyroscope") log.Info("Enabled Pyroscope", "server", server)
return nil return nil
} }