diff --git a/models/points.go b/models/points.go index 86594da57c..508d73a6ba 100644 --- a/models/points.go +++ b/models/points.go @@ -263,6 +263,11 @@ func ParsePointsString(buf string) ([]Point, error) { // NOTE: to minimize heap allocations, the returned Tags will refer to subslices of buf. // This can have the unintended effect preventing buf from being garbage collected. func ParseKey(buf []byte) (string, Tags) { + meas, tags := ParseKeyBytes(buf) + return string(meas), tags +} + +func ParseKeyBytes(buf []byte) ([]byte, Tags) { // Ignore the error because scanMeasurement returns "missing fields" which we ignore // when just parsing a key state, i, _ := scanMeasurement(buf, 0) @@ -271,9 +276,9 @@ func ParseKey(buf []byte) (string, Tags) { if state == tagKeyState { tags = parseTags(buf) // scanMeasurement returns the location of the comma if there are tags, strip that off - return string(buf[:i-1]), tags + return buf[:i-1], tags } - return string(buf[:i]), tags + return buf[:i], tags } func ParseTags(buf []byte) (Tags, error) {