From c5a72c44cc69893c1ac066d4eaa65640df4f1378 Mon Sep 17 00:00:00 2001 From: William Banfield <4561443+williambanfield@users.noreply.github.com> Date: Wed, 13 Oct 2021 12:21:35 -0400 Subject: [PATCH] Update internal/proxy/app_conn.go Co-authored-by: M. J. Fromberger --- internal/proxy/app_conn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/proxy/app_conn.go b/internal/proxy/app_conn.go index 0720d282b..5aae531a6 100644 --- a/internal/proxy/app_conn.go +++ b/internal/proxy/app_conn.go @@ -240,6 +240,9 @@ func (app *appConnSnapshot) ApplySnapshotChunkSync( return app.appConn.ApplySnapshotChunkSync(ctx, req) } +// addTimeSample returns a function that, when called, adds a sample to m for +// the time elapsed since the original call to addTimeSample. This function should +// be deferred near the start of a function to be sampled. func addTimeSample(m metrics.Histogram) func() { start := time.Now() return func() { m.Observe(time.Since(start).Seconds()) }