From 1aa37c2ff156cffc51de4e9b1c9653dcd193be40 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 23 Jan 2026 15:51:16 +0800 Subject: [PATCH] internal/debug: fix some minor issues in file pyroscope.go --- internal/debug/pyroscope.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/debug/pyroscope.go b/internal/debug/pyroscope.go index d0804cb891..0601450f48 100644 --- a/internal/debug/pyroscope.go +++ b/internal/debug/pyroscope.go @@ -47,8 +47,9 @@ var ( } pyroscopeAuthPasswordFlag = &cli.StringFlag{ Name: "pyroscope.password", - Usage: "Pyroscope basic authentication password", + Usage: "Pyroscope basic authentication password (prefer setting PYROSCOPE_PASSWORD env var instead of CLI flag)", Value: "", + EnvVars: []string{"PYROSCOPE_PASSWORD"}, Category: flags.LoggingCategory, } pyroscopeTagsFlag = &cli.StringFlag{ @@ -74,7 +75,11 @@ func startPyroscope(ctx *cli.Context) error { if tag == "" { 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 } @@ -105,7 +110,7 @@ func startPyroscope(ctx *cli.Context) error { return err } pyroscopeProfiler = profiler - log.Info("Enabled Pyroscope") + log.Info("Enabled Pyroscope", "server", server) return nil }