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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(fields) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
tagsCopy := map[string]string{}
|
tagsCopy := map[string]string{}
|
||||||
for k, v := range tags {
|
for k, v := range tags {
|
||||||
tagsCopy[k] = v
|
tagsCopy[k] = v
|
||||||
|
@ -93,10 +97,6 @@ func (a *Accumulator) AddFields(
|
||||||
fieldsCopy[k] = v
|
fieldsCopy[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(fields) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var t time.Time
|
var t time.Time
|
||||||
if len(timestamp) > 0 {
|
if len(timestamp) > 0 {
|
||||||
t = timestamp[0]
|
t = timestamp[0]
|
||||||
|
@ -114,7 +114,7 @@ func (a *Accumulator) AddFields(
|
||||||
|
|
||||||
p := &Metric{
|
p := &Metric{
|
||||||
Measurement: measurement,
|
Measurement: measurement,
|
||||||
Fields: fields,
|
Fields: fieldsCopy,
|
||||||
Tags: tagsCopy,
|
Tags: tagsCopy,
|
||||||
Time: t,
|
Time: t,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue