go-platform: github.com/micro/go-platform/monitor Index | Files | Directories

package monitor

import "github.com/micro/go-platform/monitor"

Package monitor is an interface for monitoring.


Package Files

context.go healthcheck.go monitor.go options.go os.go stats.go wrapper.go


var (
    HealthCheckTopic = "micro.monitor.healthcheck"
    StatusTopic      = "micro.monitor.status"
    StatsTopic       = "micro.monitor.stats"
var (
    ErrAlreadyExists = errors.New("already exists")
    ErrNotAvailable  = errors.New("not available")

func ClientWrapper Uses

func ClientWrapper(m Monitor) client.Wrapper

func HandlerWrapper Uses

func HandlerWrapper(m Monitor) server.HandlerWrapper

func NewContext Uses

func NewContext(ctx context.Context, c Monitor) context.Context

type Checker Uses

type Checker interface {
    NewHealthChecker(id, desc string, fn HealthCheck) HealthChecker
    Register(HealthChecker) error
    Deregister(HealthChecker) error
    HealthChecks() ([]HealthChecker, error)

Checker interface allows creation of healthchecks

type HealthCheck Uses

type HealthCheck func() (map[string]string, error)

type HealthChecker Uses

type HealthChecker interface {
    // Unique id of the healthcheck
    Id() string
    // Description of what the healthcheck does
    Description() string
    // Runs the the healthcheck
    Run() (map[string]string, error)
    // Returns the status of the last run
    // Better where the healthcheck is expensive to run
    Status() (map[string]string, error)

represents a healthcheck function

type Monitor Uses

type Monitor interface {
    Close() error
    String() string

The monitor aggregates, observes and publishes information about the current process. This includes status; started/running/stopped, stats; cpu, memory, runtime and healthchecks.

func FromContext Uses

func FromContext(ctx context.Context) (Monitor, bool)

func NewMonitor Uses

func NewMonitor(opts ...Option) Monitor

type Option Uses

type Option func(*Options)

func Client Uses

func Client(c client.Client) Option

func Interval Uses

func Interval(i time.Duration) Option

func Server Uses

func Server(s server.Server) Option

type Options Uses

type Options struct {
    Interval time.Duration
    Client   client.Client
    Server   server.Server

type Request Uses

type Request interface {
    Service() string
    Method() string

could be client or server request

type Stats Uses

type Stats interface {
    RecordStat(r Request, d time.Duration, err error)

stats interface allows recording of endpoint stats


protoPackage go_micro_os_monitor is a generated protocol buffer package.

Package monitor imports 11 packages (graph) and is imported by 2 packages. Updated 2018-02-20. Refresh now. Tools for package owners.