monitor

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNegativeInterval = errors.New("negative interval")

Functions

func GetLastSeen

func GetLastSeen(service string) time.Time

func NewHTTPHealthChecker

func NewHTTPHealthChecker(url *types.URL, config *health.HealthCheckConfig) health.HealthChecker

func NewRawHealthChecker

func NewRawHealthChecker(url *types.URL, config *health.HealthCheckConfig) health.HealthChecker

func SetLastSeen

func SetLastSeen(service string, lastSeen time.Time)

func UpdateLastSeen

func UpdateLastSeen(service string)

Types

type DockerHealthMonitor

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

func NewDockerHealthMonitor

func NewDockerHealthMonitor(client *docker.SharedClient, containerID, alias string, config *health.HealthCheckConfig, fallback health.HealthChecker) *DockerHealthMonitor

func (*DockerHealthMonitor) CheckHealth

func (mon *DockerHealthMonitor) CheckHealth() (result *health.HealthCheckResult, err error)

func (DockerHealthMonitor) Config

func (mon DockerHealthMonitor) Config() *health.HealthCheckConfig

Config implements HealthChecker.

func (DockerHealthMonitor) ContextWithTimeout

func (mon DockerHealthMonitor) ContextWithTimeout(cause string) (ctx context.Context, cancel context.CancelFunc)

func (DockerHealthMonitor) Finish

func (mon DockerHealthMonitor) Finish(reason any)

Finish implements task.TaskFinisher.

func (DockerHealthMonitor) Latency

func (mon DockerHealthMonitor) Latency() time.Duration

Latency implements HealthMonitor.

func (DockerHealthMonitor) MarshalJSON

func (mon DockerHealthMonitor) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler of HealthMonitor.

func (DockerHealthMonitor) Name

func (mon DockerHealthMonitor) Name() string

Name implements HealthMonitor.

func (DockerHealthMonitor) Start

func (mon DockerHealthMonitor) Start(parent task.Parent) E.Error

Start implements task.TaskStarter.

func (DockerHealthMonitor) Status

func (mon DockerHealthMonitor) Status() health.Status

Status implements HealthMonitor.

func (DockerHealthMonitor) String

func (mon DockerHealthMonitor) String() string

String implements fmt.Stringer of HealthMonitor.

func (DockerHealthMonitor) Task

func (mon DockerHealthMonitor) Task() *task.Task

Task implements task.TaskStarter.

func (DockerHealthMonitor) URL

func (mon DockerHealthMonitor) URL() *types.URL

URL implements HealthChecker.

func (DockerHealthMonitor) UpdateURL

func (mon DockerHealthMonitor) UpdateURL(url *types.URL)

UpdateURL implements HealthChecker.

func (DockerHealthMonitor) Uptime

func (mon DockerHealthMonitor) Uptime() time.Duration

Uptime implements HealthMonitor.

type FileServerHealthMonitor

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

func NewFileServerHealthMonitor

func NewFileServerHealthMonitor(alias string, config *health.HealthCheckConfig, path string) *FileServerHealthMonitor

func (*FileServerHealthMonitor) CheckHealth

func (FileServerHealthMonitor) Config

func (mon FileServerHealthMonitor) Config() *health.HealthCheckConfig

Config implements HealthChecker.

func (FileServerHealthMonitor) ContextWithTimeout

func (mon FileServerHealthMonitor) ContextWithTimeout(cause string) (ctx context.Context, cancel context.CancelFunc)

func (FileServerHealthMonitor) Finish

func (mon FileServerHealthMonitor) Finish(reason any)

Finish implements task.TaskFinisher.

func (FileServerHealthMonitor) Latency

func (mon FileServerHealthMonitor) Latency() time.Duration

Latency implements HealthMonitor.

func (FileServerHealthMonitor) MarshalJSON

func (mon FileServerHealthMonitor) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler of HealthMonitor.

func (FileServerHealthMonitor) Name

func (mon FileServerHealthMonitor) Name() string

Name implements HealthMonitor.

func (FileServerHealthMonitor) Start

func (mon FileServerHealthMonitor) Start(parent task.Parent) E.Error

Start implements task.TaskStarter.

func (FileServerHealthMonitor) Status

func (mon FileServerHealthMonitor) Status() health.Status

Status implements HealthMonitor.

func (FileServerHealthMonitor) String

func (mon FileServerHealthMonitor) String() string

String implements fmt.Stringer of HealthMonitor.

func (FileServerHealthMonitor) Task

func (mon FileServerHealthMonitor) Task() *task.Task

Task implements task.TaskStarter.

func (FileServerHealthMonitor) URL

func (mon FileServerHealthMonitor) URL() *types.URL

URL implements HealthChecker.

func (FileServerHealthMonitor) UpdateURL

func (mon FileServerHealthMonitor) UpdateURL(url *types.URL)

UpdateURL implements HealthChecker.

func (FileServerHealthMonitor) Uptime

func (mon FileServerHealthMonitor) Uptime() time.Duration

Uptime implements HealthMonitor.

type HTTPHealthMonitor

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

func NewHTTPHealthMonitor

func NewHTTPHealthMonitor(url *types.URL, config *health.HealthCheckConfig) *HTTPHealthMonitor

func (*HTTPHealthMonitor) CheckHealth

func (mon *HTTPHealthMonitor) CheckHealth() (result *health.HealthCheckResult, err error)

func (HTTPHealthMonitor) Config

func (mon HTTPHealthMonitor) Config() *health.HealthCheckConfig

Config implements HealthChecker.

func (HTTPHealthMonitor) ContextWithTimeout

func (mon HTTPHealthMonitor) ContextWithTimeout(cause string) (ctx context.Context, cancel context.CancelFunc)

func (HTTPHealthMonitor) Finish

func (mon HTTPHealthMonitor) Finish(reason any)

Finish implements task.TaskFinisher.

func (HTTPHealthMonitor) Latency

func (mon HTTPHealthMonitor) Latency() time.Duration

Latency implements HealthMonitor.

func (HTTPHealthMonitor) MarshalJSON

func (mon HTTPHealthMonitor) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler of HealthMonitor.

func (HTTPHealthMonitor) Name

func (mon HTTPHealthMonitor) Name() string

Name implements HealthMonitor.

func (HTTPHealthMonitor) Start

func (mon HTTPHealthMonitor) Start(parent task.Parent) E.Error

Start implements task.TaskStarter.

func (HTTPHealthMonitor) Status

func (mon HTTPHealthMonitor) Status() health.Status

Status implements HealthMonitor.

func (HTTPHealthMonitor) String

func (mon HTTPHealthMonitor) String() string

String implements fmt.Stringer of HealthMonitor.

func (HTTPHealthMonitor) Task

func (mon HTTPHealthMonitor) Task() *task.Task

Task implements task.TaskStarter.

func (HTTPHealthMonitor) URL

func (mon HTTPHealthMonitor) URL() *types.URL

URL implements HealthChecker.

func (HTTPHealthMonitor) UpdateURL

func (mon HTTPHealthMonitor) UpdateURL(url *types.URL)

UpdateURL implements HealthChecker.

func (HTTPHealthMonitor) Uptime

func (mon HTTPHealthMonitor) Uptime() time.Duration

Uptime implements HealthMonitor.

type HealthCheckFunc

type HealthCheckFunc func() (result *health.HealthCheckResult, err error)

type JSONRepresentation

type JSONRepresentation struct {
	Name     string
	Config   *health.HealthCheckConfig
	Status   health.Status
	Started  time.Time
	Uptime   time.Duration
	Latency  time.Duration
	LastSeen time.Time
	Detail   string
	URL      *net.URL
	Extra    map[string]any
}

func (*JSONRepresentation) MarshalJSON

func (jsonRepr *JSONRepresentation) MarshalJSON() ([]byte, error)

type RawHealthMonitor

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

func NewRawHealthMonitor

func NewRawHealthMonitor(url *types.URL, config *health.HealthCheckConfig) *RawHealthMonitor

func (*RawHealthMonitor) CheckHealth

func (mon *RawHealthMonitor) CheckHealth() (result *health.HealthCheckResult, err error)

func (RawHealthMonitor) Config

func (mon RawHealthMonitor) Config() *health.HealthCheckConfig

Config implements HealthChecker.

func (RawHealthMonitor) ContextWithTimeout

func (mon RawHealthMonitor) ContextWithTimeout(cause string) (ctx context.Context, cancel context.CancelFunc)

func (RawHealthMonitor) Finish

func (mon RawHealthMonitor) Finish(reason any)

Finish implements task.TaskFinisher.

func (RawHealthMonitor) Latency

func (mon RawHealthMonitor) Latency() time.Duration

Latency implements HealthMonitor.

func (RawHealthMonitor) MarshalJSON

func (mon RawHealthMonitor) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler of HealthMonitor.

func (RawHealthMonitor) Name

func (mon RawHealthMonitor) Name() string

Name implements HealthMonitor.

func (RawHealthMonitor) Start

func (mon RawHealthMonitor) Start(parent task.Parent) E.Error

Start implements task.TaskStarter.

func (RawHealthMonitor) Status

func (mon RawHealthMonitor) Status() health.Status

Status implements HealthMonitor.

func (RawHealthMonitor) String

func (mon RawHealthMonitor) String() string

String implements fmt.Stringer of HealthMonitor.

func (RawHealthMonitor) Task

func (mon RawHealthMonitor) Task() *task.Task

Task implements task.TaskStarter.

func (RawHealthMonitor) URL

func (mon RawHealthMonitor) URL() *types.URL

URL implements HealthChecker.

func (RawHealthMonitor) UpdateURL

func (mon RawHealthMonitor) UpdateURL(url *types.URL)

UpdateURL implements HealthChecker.

func (RawHealthMonitor) Uptime

func (mon RawHealthMonitor) Uptime() time.Duration

Uptime implements HealthMonitor.

Jump to

Keyboard shortcuts

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