Use fieldsCopy in testutil.Accumulator AddFields (#4970)

This commit is contained in:
Grace Do 2018-11-09 10:59:33 -08:00 committed by Daniel Nelson
parent d67eb46c3d
commit 625a1ca8fa
1 changed files with 5 additions and 5 deletions

View File

@ -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,
}