changed TestThreadStats acc to wait for 2 and added warning comment (#8592)
This commit is contained in:
parent
94eb8f2e42
commit
04e62e3d23
|
|
@ -119,7 +119,7 @@ func TestThreadStats(t *testing.T) {
|
||||||
c.Write([]byte(ex3))
|
c.Write([]byte(ex3))
|
||||||
c.Write([]byte("\n"))
|
c.Write([]byte("\n"))
|
||||||
c.Close()
|
c.Close()
|
||||||
acc.Wait(1)
|
acc.Wait(2)
|
||||||
|
|
||||||
expected := []telegraf.Metric{
|
expected := []telegraf.Metric{
|
||||||
testutil.MustMetric(
|
testutil.MustMetric(
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ func (a *Accumulator) NMetrics() uint64 {
|
||||||
return atomic.LoadUint64(&a.nMetrics)
|
return atomic.LoadUint64(&a.nMetrics)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTelegrafMetrics returns all the metrics collected by the accumulator
|
||||||
|
// If you are getting race conditions here then you are not waiting for all of your metrics to arrive: see Wait()
|
||||||
func (a *Accumulator) GetTelegrafMetrics() []telegraf.Metric {
|
func (a *Accumulator) GetTelegrafMetrics() []telegraf.Metric {
|
||||||
metrics := []telegraf.Metric{}
|
metrics := []telegraf.Metric{}
|
||||||
for _, m := range a.Metrics {
|
for _, m := range a.Metrics {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue