util/clientmetric: add test hooks and ResetLastDelta function

Necessary to force flushing of client metrics more aggressively in
dev/test mode.

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
Mihai Parparita 2022-05-06 09:52:48 -07:00 committed by GitHub
parent 35111061e9
commit 7966aed1e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -255,6 +255,10 @@ func EncodeLogTailMetricsDelta() string {
return enc.buf.String()
}
func ResetLastDeltaForTest() {
lastDelta = time.Time{}
}
var deltaPool = &sync.Pool{
New: func() any {
return new(deltaEncBuf)