healthcheck

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SectionDERP      string = "DERP"
	SectionAccessURL string = "AccessURL"
	SectionWebsocket string = "Websocket"
	SectionDatabase  string = "Database"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessURLReport

type AccessURLReport struct {
	AccessURL       string  `json:"access_url"`
	Healthy         bool    `json:"healthy"`
	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
}

type DatabaseReport

type DatabaseReport struct {
	Healthy   bool    `json:"healthy"`
	Reachable bool    `json:"reachable"`
	Latency   string  `json:"latency"`
	LatencyMs int     `json:"latency_ms"`
	Error     *string `json:"error"`
}

@typescript-generate DatabaseReport

func (*DatabaseReport) Run

type DatabaseReportOptions

type DatabaseReportOptions struct {
	DB database.Store
}

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.
	Healthy bool `json:"healthy"`
	// FailingSections is a list of sections that have failed their healthcheck.
	FailingSections []string `json:"failing_sections"`

	DERP      derphealth.Report `json:"derp"`
	AccessURL AccessURLReport   `json:"access_url"`
	Websocket WebsocketReport   `json:"websocket"`
	Database  DatabaseReport    `json:"database"`

	// 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 {
	DB database.Store
	// TODO: support getting this over HTTP?
	DERPMap   *tailcfg.DERPMap
	AccessURL *url.URL
	Client    *http.Client
	APIKey    string

	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 bool    `json:"healthy"`
	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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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