fix(enterprise/coderd/proxyhealth): properly defer healthCheckDuration observe (#10848)

This commit is contained in:
Cian Johnston
2023-11-23 15:23:40 +00:00
committed by GitHub
parent 78df68348a
commit f342d10c31

View File

@ -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))