Documentation

Overview

    Package monitor monitors service health

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var (
    	ErrNotWatching = errors.New("not watching")
    )

    Functions

    This section is empty.

    Types

    type Monitor

    type Monitor interface {
    	// Reap a service and stop monitoring
    	Reap(service string) error
    	// Check the status of the service now
    	Check(service string) error
    	// Status of the service
    	Status(service string) (Status, error)
    	// Watch starts watching the service
    	Watch(service string) error
    	// Run the monitor to watch all services
    	Run() error
    	// Stop monitoring
    	Stop() error
    }

      Monitor monitors a service and reaps dead instances

      func NewMonitor

      func NewMonitor(opts ...Option) Monitor

        NewMonitor returns a new monitor

        type Option

        type Option func(*Options)

        func Client

        func Client(c client.Client) Option

        func Registry

        func Registry(r registry.Registry) Option

        type Options

        type Options struct {
        	Client   client.Client
        	Registry registry.Registry
        }

        type Status

        type Status struct {
        	Code  StatusCode
        	Info  string
        	Error string
        }

        type StatusCode

        type StatusCode int
        const (
        	StatusUnknown StatusCode = iota
        	StatusRunning
        	StatusFailed
        )