metrics: fix flaky Example metrics test (#16222)
* metrics: add sleep to test in order to get predictable output * metrics: relax constraints on timer test
This commit is contained in:
committed by
Péter Szilágyi
parent
5a150e1b77
commit
3ca3fffdf0
@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
const FANOUT = 128
|
||||
@ -114,7 +115,7 @@ func Example() {
|
||||
|
||||
// Threadsafe registration
|
||||
t := GetOrRegisterTimer("db.get.latency", nil)
|
||||
t.Time(func() {})
|
||||
t.Time(func() { time.Sleep(10 * time.Millisecond) })
|
||||
t.Update(1)
|
||||
|
||||
fmt.Println(c.Count())
|
||||
|
Reference in New Issue
Block a user