healthcheck

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseDefaultThreshold = 15 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AGPLWorkspaceProxiesFetchUpdater added in v2.5.0

type AGPLWorkspaceProxiesFetchUpdater struct{}

AGPLWorkspaceProxiesFetchUpdater implements WorkspaceProxiesFetchUpdater to the extent required by AGPL code. Which isn't that much.

func (*AGPLWorkspaceProxiesFetchUpdater) Fetch added in v2.5.0

func (*AGPLWorkspaceProxiesFetchUpdater) Update added in v2.5.0

type AccessURLReport

type AccessURLReport 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"`
	Dismissed bool             `json:"dismissed"`

	AccessURL       string  `json:"access_url"`
	Reachable       bool    `json:"reachable"`
	StatusCode      int     `json:"status_code"`
	HealthzResponse string  `json:"healthz_response"`
	Error           *string `json:"error"`
}

@typescript-generate AccessURLReport

func (*AccessURLReport) Run

type AccessURLReportOptions

type AccessURLReportOptions struct {
	AccessURL *url.URL
	Client    *http.Client

	Dismissed bool
}

type DatabaseReport

type DatabaseReport 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"`
	Dismissed bool             `json:"dismissed"`

	Reachable   bool    `json:"reachable"`
	Latency     string  `json:"latency"`
	LatencyMS   int64   `json:"latency_ms"`
	ThresholdMS int64   `json:"threshold_ms"`
	Error       *string `json:"error"`
}

@typescript-generate DatabaseReport

func (*DatabaseReport) Run

type DatabaseReportOptions

type DatabaseReportOptions struct {
	DB        database.Store
	Threshold time.Duration

	Dismissed bool
}

type ProvisionerDaemonsReport added in v2.7.0

type ProvisionerDaemonsReport struct {
	Severity  health.Severity  `json:"severity"`
	Warnings  []health.Message `json:"warnings"`
	Dismissed bool             `json:"dismissed"`
	Error     *string          `json:"error"`

	Items []ProvisionerDaemonsReportItem `json:"items"`
}

@typescript-generate ProvisionerDaemonsReport

func (*ProvisionerDaemonsReport) Run added in v2.7.0

type ProvisionerDaemonsReportDeps added in v2.7.0

type ProvisionerDaemonsReportDeps struct {
	// Required
	CurrentVersion         string
	CurrentAPIMajorVersion int
	Store                  ProvisionerDaemonsStore

	// Optional
	TimeNow       func() time.Time // Defaults to dbtime.Now
	StaleInterval time.Duration    // Defaults to 3 heartbeats

	Dismissed bool
}

type ProvisionerDaemonsReportItem added in v2.7.0

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

@typescript-generate ProvisionerDaemonsReportItem

type ProvisionerDaemonsStore added in v2.7.0

type ProvisionerDaemonsStore interface {
	GetProvisionerDaemons(ctx context.Context) ([]database.ProvisionerDaemon, error)
}

type Report

type Report struct {
	// Time is the time the report was generated at.
	Time time.Time `json:"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 []codersdk.HealthSection `json:"failing_sections"`

	DERP               derphealth.Report        `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"`
}

@typescript-generate Report

func Run

func Run(ctx context.Context, opts *ReportOptions) *Report

type ReportOptions

type ReportOptions struct {
	AccessURL          AccessURLReportOptions
	Database           DatabaseReportOptions
	DerpHealth         derphealth.ReportOptions
	Websocket          WebsocketReportOptions
	WorkspaceProxy     WorkspaceProxyReportOptions
	ProvisionerDaemons ProvisionerDaemonsReportDeps

	Checker Checker
}

type WebsocketEchoServer

type WebsocketEchoServer struct {
	Error error
	Code  int
}

func (*WebsocketEchoServer) ServeHTTP

func (s *WebsocketEchoServer) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type WebsocketReport

type WebsocketReport 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  []string        `json:"warnings"`
	Dismissed bool            `json:"dismissed"`

	Body  string  `json:"body"`
	Code  int     `json:"code"`
	Error *string `json:"error"`
}

@typescript-generate WebsocketReport

func (*WebsocketReport) Run

type WebsocketReportOptions

type WebsocketReportOptions struct {
	APIKey     string
	AccessURL  *url.URL
	HTTPClient *http.Client

	Dismissed bool
}

type WorkspaceProxiesFetchUpdater added in v2.5.0

type WorkspaceProxiesFetchUpdater interface {
	Fetch(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy], error)
	Update(context.Context) error
}

type WorkspaceProxyReport added in v2.5.0

type WorkspaceProxyReport struct {
	Healthy   bool             `json:"healthy"`
	Severity  health.Severity  `json:"severity"`
	Warnings  []health.Message `json:"warnings"`
	Dismissed bool             `json:"dismissed"`
	Error     *string          `json:"error"`

	WorkspaceProxies codersdk.RegionsResponse[codersdk.WorkspaceProxy] `json:"workspace_proxies"`
}

@typescript-generate WorkspaceProxyReport

func (*WorkspaceProxyReport) Run added in v2.5.0

type WorkspaceProxyReportOptions added in v2.5.0

type WorkspaceProxyReportOptions struct {
	// CurrentVersion is the current server version.
	// We pass this in to make it easier to test.
	CurrentVersion               string
	WorkspaceProxiesFetchUpdater WorkspaceProxiesFetchUpdater

	Dismissed bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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