cmd/utils: keep metrics tag values containing '='

SplitTagsFlag split each "k=v" tag on every "=" with strings.Split,
producing more than two parts whenever the value itself contained an
"=" (e.g. build=release=2026). Such a tag failed the len(kv) == 2 check
and was silently dropped.

Use strings.SplitN(t, "=", 2) so the split happens only on the first
"=", keeping the remainder as the value. A tag list like
'host=node1,build=release=2026' now retains the build tag.
This commit is contained in:
cuiweixie 2026-06-13 18:56:00 +08:00
parent eea6242742
commit 5bc59de935

View file

@ -2268,7 +2268,7 @@ func SplitTagsFlag(tagsFlag string) map[string]string {
for _, t := range tags { for _, t := range tags {
if t != "" { if t != "" {
kv := strings.Split(t, "=") kv := strings.SplitN(t, "=", 2)
if len(kv) == 2 { if len(kv) == 2 {
tagsMap[kv[0]] = kv[1] tagsMap[kv[0]] = kv[1]