Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( StateRun = state{"run"} StateComplete = state{"complete"} StateFail = state{"fail"} )
var ErrUnexpectedStatusCode = errors.New("cronitor: received unexpected HTTP status code")
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor represents a Cronitor job monitor.
A Monitor with an empty URL behaves as a "no-op Monitor" and does not make HTTP requests.
func New ¶
New creates a new Monitor with the given Cronitor telemetry URL. Panics if "net/url".Parse fails.
Passing the empty string will create a "no-op Monitor" that does not make any HTTP requests.
func (*Monitor) SetState ¶
SetState sets the state of the monitor. Panics if the state transition is not allowed.
If the HTTP request fails or the response status code is not OK, SetState returns an error and the internal state will be reverted to the previous state. If the Monitor is a "no-op Monitor" (i.e. the URL is the empty string), SetState will still advance the internal state of the Monitor.