From fd4e84a1cb6d27a3885de6099002c3789e27e02c Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 23 Nov 2023 15:12:42 +0000 Subject: [PATCH] fix(enterprise/coderd/proxyhealth): properly defer healthCheckDuration observe --- 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 9f3abdac849f2..f4014e398135b 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))