healthsdk

package
v2.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AccessURLReport

type AccessURLReport struct {
	BaseReport
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy         bool   `json:"healthy"`
	AccessURL       string `json:"access_url"`
	Reachable       bool   `json:"reachable"`
	StatusCode      int    `json:"status_code"`
	HealthzResponse string `json:"healthz_response"`
}

AccessURLReport shows the results of performing a HTTP_GET to the /healthz endpoint through the configured access URL.

type BaseReport added in v2.11.0

type BaseReport struct {
	Error     *string          `json:"error"`
	Severity  health.Severity  `json:"severity" enums:"ok,warning,error"`
	Warnings  []health.Message `json:"warnings"`
	Dismissed bool             `json:"dismissed"`
}

BaseReport holds fields common to various health reports.

func (*BaseReport) Summarize added in v2.11.0

func (b *BaseReport) Summarize(prefix, docsURL string) []string

Summarize returns a list of strings containing the errors and warnings of BaseReport, if present. All strings are prefixed with prefix.

type DERPHealthReport

type DERPHealthReport struct {
	BaseReport
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy      bool                      `json:"healthy"`
	Regions      map[int]*DERPRegionReport `json:"regions"`
	Netcheck     *netcheck.Report          `json:"netcheck"`
	NetcheckErr  *string                   `json:"netcheck_err"`
	NetcheckLogs []string                  `json:"netcheck_logs"`
}

DERPHealthReport includes health details of each configured DERP/STUN region.

type DERPNodeReport

type DERPNodeReport struct {
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy  bool             `json:"healthy"`
	Severity health.Severity  `json:"severity" enums:"ok,warning,error"`
	Warnings []health.Message `json:"warnings"`
	Error    *string          `json:"error"`

	Node *tailcfg.DERPNode `json:"node"`

	ServerInfo          derp.ServerInfoMessage `json:"node_info"`
	CanExchangeMessages bool                   `json:"can_exchange_messages"`
	RoundTripPing       string                 `json:"round_trip_ping"`
	RoundTripPingMs     int                    `json:"round_trip_ping_ms"`
	UsesWebsocket       bool                   `json:"uses_websocket"`
	ClientLogs          [][]string             `json:"client_logs"`
	ClientErrs          [][]string             `json:"client_errs"`

	STUN STUNReport `json:"stun"`
}

DERPHealthReport includes health details of a single node in a single region.

type DERPRegionReport

type DERPRegionReport struct {
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy     bool                `json:"healthy"`
	Severity    health.Severity     `json:"severity" enums:"ok,warning,error"`
	Warnings    []health.Message    `json:"warnings"`
	Error       *string             `json:"error"`
	Region      *tailcfg.DERPRegion `json:"region"`
	NodeReports []*DERPNodeReport   `json:"node_reports"`
}

DERPHealthReport includes health details of each node in a single region.

type DatabaseReport

type DatabaseReport struct {
	BaseReport
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy     bool   `json:"healthy"`
	Reachable   bool   `json:"reachable"`
	Latency     string `json:"latency"`
	LatencyMS   int64  `json:"latency_ms"`
	ThresholdMS int64  `json:"threshold_ms"`
}

DatabaseReport shows the results of pinging the configured database.Conn.

type HealthClient

type HealthClient struct {
	// contains filtered or unexported fields
}

@typescript-ignore HealthClient

func New

func New(c *codersdk.Client) *HealthClient

func (*HealthClient) DebugHealth

func (c *HealthClient) DebugHealth(ctx context.Context) (HealthcheckReport, error)

func (*HealthClient) HealthSettings

func (c *HealthClient) HealthSettings(ctx context.Context) (HealthSettings, error)

func (*HealthClient) PutHealthSettings

func (c *HealthClient) PutHealthSettings(ctx context.Context, settings HealthSettings) error

type HealthSection

type HealthSection string
const (
	HealthSectionDERP               HealthSection = "DERP"
	HealthSectionAccessURL          HealthSection = "AccessURL"
	HealthSectionWebsocket          HealthSection = "Websocket"
	HealthSectionDatabase           HealthSection = "Database"
	HealthSectionWorkspaceProxy     HealthSection = "WorkspaceProxy"
	HealthSectionProvisionerDaemons HealthSection = "ProvisionerDaemons"
)

If you add another const below, make sure to add it to HealthSections!

type HealthSettings

type HealthSettings struct {
	DismissedHealthchecks []HealthSection `json:"dismissed_healthchecks"`
}

type HealthcheckReport

type HealthcheckReport struct {
	// Time is the time the report was generated at.
	Time time.Time `json:"time" format:"date-time"`
	// Healthy is true if the report returns no errors.
	// Deprecated: use `Severity` instead
	Healthy bool `json:"healthy"`
	// Severity indicates the status of Coder health.
	Severity health.Severity `json:"severity" enums:"ok,warning,error"`
	// FailingSections is a list of sections that have failed their healthcheck.
	FailingSections []HealthSection `json:"failing_sections"`

	DERP               DERPHealthReport         `json:"derp"`
	AccessURL          AccessURLReport          `json:"access_url"`
	Websocket          WebsocketReport          `json:"websocket"`
	Database           DatabaseReport           `json:"database"`
	WorkspaceProxy     WorkspaceProxyReport     `json:"workspace_proxy"`
	ProvisionerDaemons ProvisionerDaemonsReport `json:"provisioner_daemons"`

	// The Coder version of the server that the report was generated on.
	CoderVersion string `json:"coder_version"`
}

HealthcheckReport contains information about the health status of a Coder deployment.

func (*HealthcheckReport) Summarize added in v2.11.0

func (r *HealthcheckReport) Summarize(docsURL string) []string

Summarize returns a summary of all errors and warnings of components of HealthcheckReport.

type ProvisionerDaemonsReport

type ProvisionerDaemonsReport struct {
	BaseReport
	Items []ProvisionerDaemonsReportItem `json:"items"`
}

ProvisionerDaemonsReport includes health details of each connected provisioner daemon.

type ProvisionerDaemonsReportItem

type ProvisionerDaemonsReportItem struct {
	codersdk.ProvisionerDaemon `json:"provisioner_daemon"`
	Warnings                   []health.Message `json:"warnings"`
}

type STUNReport

type STUNReport struct {
	Enabled bool
	CanSTUN bool
	Error   *string
}

STUNReport contains information about a given node's STUN capabilities.

type UpdateHealthSettings

type UpdateHealthSettings struct {
	DismissedHealthchecks []HealthSection `json:"dismissed_healthchecks"`
}

type WebsocketReport

type WebsocketReport struct {
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy bool `json:"healthy"`
	BaseReport
	Body string `json:"body"`
	Code int    `json:"code"`
}

WebsocketReport shows if the configured access URL allows establishing WebSocket connections.

type WorkspaceProxyReport

type WorkspaceProxyReport struct {
	// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
	Healthy bool `json:"healthy"`
	BaseReport
	WorkspaceProxies codersdk.RegionsResponse[codersdk.WorkspaceProxy] `json:"workspace_proxies"`
}

WorkspaceProxyReport includes health details of each connected workspace proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL