Skip to content

Commit fc18f4a

Browse files
committed
fix: fix tags
1 parent b7af3dd commit fc18f4a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

cmd/dogstatsd-local/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ func main() {
3232
debug := flag.Bool("debug", false, "Enable debug mode")
3333
flag.Parse()
3434

35-
extraTags := strings.Split(*rawTags, ",")
35+
var extraTags []string
36+
if *rawTags != "" {
37+
extraTags = strings.Split(*rawTags, ",")
38+
}
3639
logger := getLogger(*debug)
3740

3841
var formatHandler format.Handler

internal/format/pretty/pretty.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,5 @@ func (h *Handler) StyledTags(metric messages.DogStatsDMetric, extraTags []string
119119
style := lipgloss.NewStyle().
120120
Foreground(h.Theme.Overlay0()).
121121
Italic(true)
122-
var tags []string
123-
for _, tag := range append(extraTags, metric.Tags...) {
124-
tags = append(tags, strings.TrimSpace(tag))
125-
}
126-
return style.SetString(tags...).Render()
122+
return style.SetString(append(extraTags, metric.Tags...)...).Render()
127123
}

internal/messages/messages.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ func parseDogStatsDMetricMessage(buf []byte) (DogStatsDMessage, error) {
171171

172172
if strings.HasPrefix(piece, "#") {
173173
tags := strings.Split(piece[1:], ",")
174+
for i, _ := range tags {
175+
tags[i] = strings.TrimSpace(tags[i])
176+
}
174177
metric.Tags = append(metric.Tags, tags...)
175178
continue
176179
}

0 commit comments

Comments
 (0)