code refactor

This commit is contained in:
Ulric Qin 2022-04-15 11:03:33 +08:00
parent 5f7bccaffd
commit 932b0ecfc9
1 changed files with 1 additions and 14 deletions

View File

@ -46,20 +46,7 @@ func NewSamples(fields map[string]interface{}, labels ...map[string]string) []*t
if err != nil {
continue
}
sample := &types.Sample{
Metric: metric,
Value: floatValue,
Labels: make(map[string]string),
}
for i := 0; i < len(labels); i++ {
for k, v := range labels[i] {
sample.Labels[k] = v
}
}
samples = append(samples, sample)
samples = append(samples, NewSample(metric, floatValue, labels...))
}
return samples