Skip to content

Commit

Permalink
fix parsing string replacing code
Browse files Browse the repository at this point in the history
Signed-off-by: alexgreenbank <[email protected]>
  • Loading branch information
alexgreenbank committed Jan 14, 2025
1 parent 0e6cea6 commit 8afdd9b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/distributor/influxpush/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ func influxPointToTimeseries(pt models.Point, returnTs []mimirpb.PreallocTimeser
continue
}

name := replaceInvalidChars(pt.Name())
// Make a copy of pt.Name() otherwise the replaceInvalidChars() modifies the data
// by possibly prepending to the slice which upsets subsequent calls to pt.Name()
name := append([]byte{}, pt.Name()...)
name = replaceInvalidChars(name)
if field != "value" {
// If the field name is not "value" then we append it to the name, fixing chars as we go
name = append([]byte{'_'}, name...)
name = append(name, byte('_'))
name = append(name, replaceInvalidChars([]byte(field))...)
}

tags := pt.Tags()
Expand Down

0 comments on commit 8afdd9b

Please sign in to comment.