@@ -146,12 +146,13 @@ func (p *ProxyHealth) storeProxyHealth(statuses map[uuid.UUID]ProxyStatus) {
146
146
var healthyHosts []string
147
147
for _ , s := range statuses {
148
148
if s .Status == Healthy {
149
- healthyHosts = append (healthyHosts , s .ProxyHostname )
149
+ healthyHosts = append (healthyHosts , s .ProxyHost )
150
150
}
151
151
}
152
152
153
153
// Store the statuses in the cache before any other quick values.
154
154
p .cache .Store (& statuses )
155
+ fmt .Println (healthyHosts )
155
156
p .heathyHosts .Store (& healthyHosts )
156
157
}
157
158
@@ -178,11 +179,11 @@ func (p *ProxyHealth) HealthStatus() map[uuid.UUID]ProxyStatus {
178
179
return * ptr
179
180
}
180
181
181
- // HealthyHostnames returns the hostnames of all healthy proxies.
182
+ // HealthyHosts returns the host:port of all healthy proxies.
182
183
// This can be computed from HealthStatus, but is cached to avoid the
183
184
// caller needing to loop over all proxies to compute this on all
184
185
// static web requests.
185
- func (p * ProxyHealth ) HealthyHostnames () []string {
186
+ func (p * ProxyHealth ) HealthyHosts () []string {
186
187
ptr := p .heathyHosts .Load ()
187
188
if ptr == nil {
188
189
return []string {}
@@ -196,13 +197,13 @@ type ProxyStatus struct {
196
197
// then the proxy in hand. AKA if the proxy was updated, and the status was for
197
198
// an older proxy.
198
199
Proxy database.WorkspaceProxy
199
- // ProxyHostname is the hostname of the proxy url. This is included in the status
200
+ // ProxyHost is the host:port of the proxy url. This is included in the status
200
201
// to make sure the proxy url is a valid URL. It also makes it easier to
201
202
// escalate errors if the url.Parse errors (should never happen).
202
- ProxyHostname string
203
- Status Status
204
- Report codersdk.ProxyHealthReport
205
- CheckedAt time.Time
203
+ ProxyHost string
204
+ Status Status
205
+ Report codersdk.ProxyHealthReport
206
+ CheckedAt time.Time
206
207
}
207
208
208
209
// runOnce runs the health check for all workspace proxies. If there is an
@@ -288,7 +289,7 @@ func (p *ProxyHealth) runOnce(ctx context.Context, now time.Time) (map[uuid.UUID
288
289
break
289
290
}
290
291
status .Status = Healthy
291
- status .ProxyHostname = u .Hostname ()
292
+ status .ProxyHost = u .Host
292
293
case err == nil && resp .StatusCode != http .StatusOK :
293
294
// Unhealthy as we did reach the proxy but it got an unexpected response.
294
295
status .Status = Unhealthy
0 commit comments