validate and tidy label key

This commit is contained in:
Ulric Qin 2022-06-07 11:23:01 +08:00
parent 3af20d1813
commit 95007aaf3c
1 changed files with 4 additions and 0 deletions

View File

@ -217,6 +217,10 @@ func convert(item *types.Sample) *prompb.TimeSeries {
// add other labels
for k, v := range item.Labels {
k = strings.Replace(k, "/", "_", -1)
k = strings.Replace(k, ".", "_", -1)
k = strings.Replace(k, "-", "_", -1)
k = strings.Replace(k, " ", "_", -1)
pt.Labels = append(pt.Labels, &prompb.Label{
Name: k,
Value: v,