Skip to content

Commit 239703e

Browse files
committed
fix: reverse fab44a6, do not add null key to labels
1 parent 2541b53 commit 239703e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

task/task.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,10 @@ func (service *Service) metric2Row(metric model.Metric, msg *model.InputMessage)
252252
dim := service.dims[i]
253253
val := model.GetValueByType(metric, dim)
254254
row = append(row, val)
255-
if dim.Type.Type == model.String && dim.Name != service.nameKey && dim.Name != "le" && (service.lblBlkList == nil || !service.lblBlkList.MatchString(dim.Name)) {
255+
if val != nil && dim.Type.Type == model.String && dim.Name != service.nameKey && dim.Name != "le" && (service.lblBlkList == nil || !service.lblBlkList.MatchString(dim.Name)) {
256256
// "labels" JSON excludes "le", so that "labels" can be used as group key for histogram queries.
257257
// todo: what does "le" mean?
258-
var labelVal string
259-
if val == nil {
260-
labelVal = "null"
261-
} else {
262-
labelVal = val.(string)
263-
}
258+
labelVal := val.(string)
264259
labels = append(labels, fmt.Sprintf(`%s: %s`, strconv.Quote(dim.Name), strconv.Quote(labelVal)))
265260
}
266261
}

0 commit comments

Comments
 (0)