healthchecks

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: LGPL-3.0 Imports: 6 Imported by: 1

README

healthchecks

A healthchecks.io wrapper

check the godoc for information

hc := healthchecks.New("your-uuid")
go hc.Auto()

hc.Log(strings.NewReader("optional body you can attach to any action"))
hc.Shutdown()

Documentation

Index

Constants

View Source
const DefaultAPI = "https://hc-ping.com"

DefaultAPI base url for checks

Variables

View Source
var DefaultErrLog = func(operation string, err error) {
	fmt.Printf("healtchecks operation %q failed: %v\n", operation, err)
}

DefaultErrLog if you don't provide one yourself

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTP *http.Client
	// contains filtered or unexported fields
}

Client for healthchecks

func New

func New(hcUUID string, errlog ...ErrLog) *Client

New healthchecks client

func (*Client) Auto

func (c *Client) Auto(every time.Duration)

Auto is intended to start as separate goroutine (go c.Auto(5*time.Second)) it will automatically send Success (ping) requests, leaving the client itself fully usable to stop the Auto(), call Shutdown() and destroy the client

func (*Client) ExitStatus

func (c *Client) ExitStatus(exitCode int, optionalBody ...io.Reader)

ExitStatus signal sends job's exit code (0-255)

func (*Client) Fail

func (c *Client) Fail(optionalBody ...io.Reader)

Fail signal means the job failed

func (*Client) Log

func (c *Client) Log(optionalBody ...io.Reader)

Log signal just adds an event to the job log, without changing job status

func (*Client) Shutdown

func (c *Client) Shutdown()

Shutdown the client

func (*Client) Start

func (c *Client) Start(optionalBody ...io.Reader)

Start signal means the job started

func (*Client) Success

func (c *Client) Success(optionalBody ...io.Reader)

Success signal means the job has completed successfully (or, a continuously running process is still running and healthy).

type ErrLog

type ErrLog func(operation string, err error)

ErrLog used to log errors occurred during an operation

Jump to

Keyboard shortcuts

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