From f342d10c318d33869919e4ca35cc5bd3fcc40789 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 23 Nov 2023 15:23:40 +0000 Subject: [PATCH] fix(enterprise/coderd/proxyhealth): properly defer healthCheckDuration observe (#10848) --- enterprise/coderd/proxyhealth/proxyhealth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise/coderd/proxyhealth/proxyhealth.go b/enterprise/coderd/proxyhealth/proxyhealth.go index 9f3abdac84..f4014e3981 100644 --- a/enterprise/coderd/proxyhealth/proxyhealth.go +++ b/enterprise/coderd/proxyhealth/proxyhealth.go @@ -215,7 +215,7 @@ func (p *ProxyHealth) ProxyHosts() []string { // unreachable. func (p *ProxyHealth) runOnce(ctx context.Context, now time.Time) (map[uuid.UUID]ProxyStatus, error) { // Record from the given time. - defer p.healthCheckDuration.Observe(time.Since(now).Seconds()) + defer func() { p.healthCheckDuration.Observe(time.Since(now).Seconds()) }() //nolint:gocritic // Proxy health is a system service. proxies, err := p.db.GetWorkspaceProxies(dbauthz.AsSystemRestricted(ctx))