cmd/utils: keep metrics tag values containing '=' (#35168)

This commit is contained in:
cui 2026-07-03 14:59:28 +08:00 committed by GitHub
parent d617f4fcdb
commit aa3d286f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -2284,7 +2284,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]

View file

@ -52,7 +52,9 @@ func Test_SplitTagsFlag(t *testing.T) {
{ {
"garbage", "garbage",
"smth=smthelse=123", "smth=smthelse=123",
map[string]string{}, map[string]string{
"smth": "smthelse=123",
},
}, },
} }
for _, tt := range tests { for _, tt := range tests {