proxyhealth
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeProxyHealth¶
type ProxyHealth struct {// contains filtered or unexported fields}
ProxyHealth runs a go routine that periodically checks the health of allworkspace proxies. This information is stored in memory, so each coderdreplica has its own view of the health of the proxies. These views should beconsistent, and if they are not, it indicates a problem.
funcNew¶
func New(opts *Options) (*ProxyHealth,error)
func (*ProxyHealth)ForceUpdate¶
func (p *ProxyHealth) ForceUpdate(ctxcontext.Context)error
ForceUpdate runs a single health check and updates the cache. If the healthcheck fails, the cache is not updated and an error is returned. This is usefulto trigger an update when a proxy is created or deleted.
func (*ProxyHealth)HealthStatus¶
func (p *ProxyHealth) HealthStatus() map[uuid.UUID]ProxyStatus
HealthStatus returns the current health status of all proxies stored in thecache.
func (*ProxyHealth)ProxyHosts¶added inv0.23.1
func (p *ProxyHealth) ProxyHosts() []string
ProxyHosts returns the host:port of all healthy proxies.This can be computed from HealthStatus, but is cached to avoid thecaller needing to loop over all proxies to compute this on allstatic web requests.
func (*ProxyHealth)Run¶
func (p *ProxyHealth) Run(ctxcontext.Context)
Run will block until the context is canceled. It will periodically check thehealth of all proxies and store the results in the cache.
typeProxyStatus¶
type ProxyStatus struct {// ProxyStatus includes the value of the proxy at the time of checking. This is// useful to know as it helps determine if the proxy checked has different values// then the proxy in hand. AKA if the proxy was updated, and the status was for// an older proxy.Proxydatabase.WorkspaceProxy// ProxyHost is the host:port of the proxy url. This is included in the status// to make sure the proxy url is a valid URL. It also makes it easier to// escalate errors if the url.Parse errors (should never happen).ProxyHoststringStatusStatusReportcodersdk.ProxyHealthReportCheckedAttime.Time}
typeStatus¶
type Statusstring
const (// Unknown should never be returned by the proxy health check.UnknownStatus = "unknown"// Healthy means the proxy access url is reachable and returns a healthy// status code.HealthyStatus = "ok"// Unreachable means the proxy access url is not responding.UnreachableStatus = "unreachable"// Unhealthy means the proxy access url is responding, but there is some// problem with the proxy. This problem may or may not be preventing functionality.UnhealthyStatus = "unhealthy"// Unregistered means the proxy has not registered a url yet. This means// the proxy was created with the cli, but has not yet been started.UnregisteredStatus = "unregistered")