From a1dae2f79eff65506b304bdfde9fc66794bdbd0e Mon Sep 17 00:00:00 2001 From: Torin Sandall Date: Tue, 7 Dec 2021 13:54:38 -0800 Subject: [PATCH] download: Add timer to HTTP request Signed-off-by: Torin Sandall --- download/download.go | 2 ++ metrics/metrics.go | 1 + 2 files changed, 3 insertions(+) diff --git a/download/download.go b/download/download.go index 8861638703..2894179120 100644 --- a/download/download.go +++ b/download/download.go @@ -278,7 +278,9 @@ func (d *Downloader) download(ctx context.Context, m metrics.Metrics) (*download } } + m.Timer(metrics.BundleRequest).Start() resp, err := d.client.Do(ctx, "GET", d.path) + m.Timer(metrics.BundleRequest).Stop() if err != nil { return nil, errors.Wrap(err, "request failed") } diff --git a/metrics/metrics.go b/metrics/metrics.go index 3974b794d6..4f31a44515 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -19,6 +19,7 @@ import ( // Well-known metric names. const ( + BundleRequest = "bundle_request" ServerHandler = "server_handler" ServerQueryCacheHit = "server_query_cache_hit" SDKDecisionEval = "sdk_decision_eval"