Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka committed Mar 20, 2021
1 parent ad1cc66 commit 3728646
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/store/labelpb/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ func CopyZLabelsToPromLabels(lset []ZLabel) labels.Labels {
ret := make(labels.Labels, len(lset))
for j := range lset {
ret[j] = labels.Label{
// NOTE: This trick converts from string to byte without copy, but copy when creating string.
Name: string(*(*[]byte)(unsafe.Pointer(&lset[j].Name))),
Value: string(*(*[]byte)(unsafe.Pointer(&lset[j].Value))),
}
}
return *(*labels.Labels)(unsafe.Pointer(&lset))
return ret
}

// LabelsFromPromLabels converts Prometheus labels to slice of labelpb.ZLabel in type unsafe manner.
Expand Down

0 comments on commit 3728646

Please sign in to comment.