health

package
v0.0.0-...-8fa2440 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package health provides a simple web server health monitoring system.

A series of criterions are created. The process is considered to be in good health if all criterions have positive counts. Otherwise, the process is in bad health. The internal implementation uses refcounting.

The health of the process can be queried at /health on the default HTTP serve mux. This returns 200 or 503. /health/info provides more detailed info about bad criterions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Criterion

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

func NewCriterion

func NewCriterion(name string, ok bool) *Criterion

Create a new criterion. If ok is true, the initial counter value is 1; otherwise, it is 0.

func (*Criterion) Add

func (c *Criterion) Add(x int)

Add to the criterion counter. If the resulting count is positive, the criterion is in good health.

func (*Criterion) Dec

func (c *Criterion) Dec()

Decrement the counter.

func (*Criterion) Inc

func (c *Criterion) Inc()

Increment the counter.

func (*Criterion) Name

func (c *Criterion) Name() string

Returns the criterion name passed at creation.

func (*Criterion) SetStatus

func (c *Criterion) SetStatus(status string)

Set the criterion status. This is a freeform string which you may optionally use to describe the current criterion status.

func (*Criterion) Status

func (c *Criterion) Status() string

Return the current criterion status. The default status is the empty string.

func (*Criterion) String

func (c *Criterion) String() string

A descriptive string representing the criterion.

func (*Criterion) Sub

func (c *Criterion) Sub(x int)

Subtract from the criterion counter. If the resulting count is not positive, the criterion is in bad healt.

func (*Criterion) Value

func (c *Criterion) Value() int

Return the criterion counter. If the counter is positive, the criterion is in good health.

Jump to

Keyboard shortcuts

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