actions

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package actions provides API to implement goma actions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("action not found")
)

Errors for actions.

Functions

func Register

func Register(name string, ctor Constructor)

Register registers a constructor of a kind of probes.

Types

type Actor

type Actor interface {
	// Init is called when goma starts monitoring.
	//
	// name is the monitor name.
	// Non-nil error is logged, and STOPS the monitor.
	Init(name string) error

	// Fail is called when a probe is start failing.
	//
	// name is the monitor name.
	// v is the returned value from the probe (or a value from the filter).
	// Non-nil error is logged, but will not stop the monitor.
	Fail(name string, v float64) error

	// Recover is called when a probe is recovered from failure.
	//
	// name is the monitor name.
	// d is the failure duration.
	// Non-nil error is logged, but will not stop the monitor.
	//
	// Note that this may not always be called if goma is stopped
	// during failure.  Init is the good place to correct such status.
	Recover(name string, d time.Duration) error

	// String returns a descriptive string for this action.
	String() string
}

Actor is the interface for actions.

func Construct

func Construct(name string, params map[string]interface{}) (Actor, error)

Construct constructs a named action. This function is used internally in goma.

type Constructor

type Constructor func(params map[string]interface{}) (Actor, error)

Constructor is a function to create an action.

params are configuration options for the action.

Directories

Path Synopsis
Package all import all actions to be compiled-in.
Package all import all actions to be compiled-in.
Package exec implements "exec" action type that runs arbitrary commands.
Package exec implements "exec" action type that runs arbitrary commands.
Package http implements "http" action type that send events to HTTP(S) server.
Package http implements "http" action type that send events to HTTP(S) server.
Package mail implements "mail" action type that send mails.
Package mail implements "mail" action type that send mails.

Jump to

Keyboard shortcuts

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