Skip to content

Commit

Permalink
feat: stats counter supports storing string type as tag
Browse files Browse the repository at this point in the history
  • Loading branch information
lzf575 committed Nov 26, 2024
1 parent 5dbb45e commit 81f474b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/libs/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,14 @@ func sendStatsd(bp client.BatchPoints) {
dfStats.TagValues = append(dfStats.TagValues, point.Tags()[v])
}

for k := range fields {
dfStats.MetricsFloatNames = append(dfStats.MetricsFloatNames, k)
for k, v := range fields {
switch v.(type) {
case string:
dfStats.TagNames = append(dfStats.TagNames, k)
dfStats.TagValues = append(dfStats.TagValues, v.(string))
default:
dfStats.MetricsFloatNames = append(dfStats.MetricsFloatNames, k)
}
}
sort.Slice(dfStats.MetricsFloatNames, func(i, j int) bool {
return dfStats.MetricsFloatNames[i] < dfStats.MetricsFloatNames[j]
Expand Down

0 comments on commit 81f474b

Please sign in to comment.