From 932b0ecfc902f784da302e8dec23546674f7aaec Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Fri, 15 Apr 2022 11:03:33 +0800 Subject: [PATCH] code refactor --- inputs/inputs.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/inputs/inputs.go b/inputs/inputs.go index 1e759f7..76ffb7a 100644 --- a/inputs/inputs.go +++ b/inputs/inputs.go @@ -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