Use fieldsCopy in testutil.Accumulator AddFields (#4970)
This commit is contained in:
parent
d67eb46c3d
commit
625a1ca8fa
|
@ -83,6 +83,10 @@ func (a *Accumulator) AddFields(
|
|||
return
|
||||
}
|
||||
|
||||
if len(fields) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
tagsCopy := map[string]string{}
|
||||
for k, v := range tags {
|
||||
tagsCopy[k] = v
|
||||
|
@ -93,10 +97,6 @@ func (a *Accumulator) AddFields(
|
|||
fieldsCopy[k] = v
|
||||
}
|
||||
|
||||
if len(fields) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var t time.Time
|
||||
if len(timestamp) > 0 {
|
||||
t = timestamp[0]
|
||||
|
@ -114,7 +114,7 @@ func (a *Accumulator) AddFields(
|
|||
|
||||
p := &Metric{
|
||||
Measurement: measurement,
|
||||
Fields: fields,
|
||||
Fields: fieldsCopy,
|
||||
Tags: tagsCopy,
|
||||
Time: t,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue