Documentation
¶
Index ¶
- Variables
- type CheckResult
- type Incident
- func (i *Incident) Actions() []IncidentAction
- func (i *Incident) Cause() string
- func (i *Incident) CheckedURL() string
- func (i *Incident) CreatedAt() time.Time
- func (i *Incident) ID() domain.ID
- func (i *Incident) IsResolved() bool
- func (i *Incident) MonitorID() domain.ID
- func (i *Incident) Resolve()
- func (i *Incident) ResolvedAt() *time.Time
- func (i *Incident) ResponseStatusCode() *int16
- type IncidentAction
- type IncidentActionType
- type IncidentRepository
- type Monitor
- func (m *Monitor) AccountID() domain.ID
- func (m *Monitor) CheckInterval() time.Duration
- func (m *Monitor) CheckResults() []CheckResult
- func (m *Monitor) CreatedAt() time.Time
- func (m *Monitor) DownSince() *time.Time
- func (m *Monitor) Edit(endpointUrl string, checkIntervalInSeconds time.Duration) error
- func (m *Monitor) EndpointUrl() string
- func (m *Monitor) HasIncidentUnresolved() bool
- func (m *Monitor) ID() domain.ID
- func (m *Monitor) IncidentUnresolved() *Incident
- func (m *Monitor) Incidents() []*Incident
- func (m *Monitor) IsEndpointUp() bool
- func (m *Monitor) IsPaused() bool
- func (m *Monitor) IsValid() bool
- func (m *Monitor) LastCheckedAt() *time.Time
- func (m *Monitor) MarkEndpointAsDown()
- func (m *Monitor) MarkEndpointAsUp()
- func (m *Monitor) Pause()
- func (m *Monitor) SetEndpointCheckResult(isUp bool)
- func (m *Monitor) Subscribers() []*Subscriber
- func (m *Monitor) UnPause()
- func (m *Monitor) UpSince() *time.Time
- type Region
- type Repository
- type Subscriber
- type URL
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEndpointIsDown = errors.New("endpoint is down") ErrMonitorNotFound = errors.New("monitor not found") ErrIncidentNotFound = errors.New("incident not found") )
View Source
var ( IncidentActionTypeCreated = IncidentActionType{"created"} IncidentActionTypeResolved = IncidentActionType{"resolved"} IncidentActionTypeAcknowledged = IncidentActionType{"acknowledged"} )
View Source
var ( RegionAfrica = Region{"africa"} RegionEurope = Region{"europe"} RegionNorthAmerica = Region{"north-america"} RegionSouthAmerica = Region{"south-america"} RegionMiddleEast = Region{"middle-east"} RegionAsia = Region{"asia"} RegionAustralia = Region{"australia"} Regions = []Region{ RegionAfrica, RegionEurope, RegionNorthAmerica, RegionSouthAmerica, RegionMiddleEast, RegionAsia, RegionAustralia, } )
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
// contains filtered or unexported fields
}
func NewCheckResult ¶
func (*CheckResult) CheckedAt ¶
func (c *CheckResult) CheckedAt() time.Time
func (*CheckResult) ID ¶
func (c *CheckResult) ID() domain.ID
func (*CheckResult) IsEndpointDown ¶
func (c *CheckResult) IsEndpointDown() bool
func (*CheckResult) Region ¶
func (c *CheckResult) Region() Region
func (*CheckResult) ResponseTimeInMs ¶
func (c *CheckResult) ResponseTimeInMs() int16
func (*CheckResult) StatusCode ¶
func (c *CheckResult) StatusCode() *int16
type Incident ¶
type Incident struct {
// contains filtered or unexported fields
}
func NewIncident ¶
func (*Incident) Actions ¶
func (i *Incident) Actions() []IncidentAction
func (*Incident) CheckedURL ¶
func (*Incident) IsResolved ¶
func (*Incident) ResolvedAt ¶
func (*Incident) ResponseStatusCode ¶
type IncidentAction ¶
type IncidentAction struct {
// contains filtered or unexported fields
}
func NewIncidentAction ¶
func NewIncidentAction( id domain.ID, takenByUserWithID *domain.ID, at time.Time, description string, actionType IncidentActionType, ) (*IncidentAction, error)
func (*IncidentAction) ActionType ¶
func (i *IncidentAction) ActionType() IncidentActionType
func (*IncidentAction) Description ¶
func (i *IncidentAction) Description() string
func (*IncidentAction) Id ¶
func (i *IncidentAction) Id() domain.ID
func (*IncidentAction) TakenAt ¶
func (i *IncidentAction) TakenAt() time.Time
func (*IncidentAction) TakerUserID ¶
func (i *IncidentAction) TakerUserID() *domain.ID
type IncidentActionType ¶
type IncidentActionType struct {
// contains filtered or unexported fields
}
func (IncidentActionType) String ¶
func (t IncidentActionType) String() string
type IncidentRepository ¶
type IncidentRepository interface { FindByID(ctx context.Context, id domain.ID) (*Incident, error) Create(ctx context.Context, incident *Incident) error Update(ctx context.Context, id domain.ID, fn func(incident *Incident) error) error AppendIncidentAction(ctx context.Context, incidentID domain.ID, incidentAction *IncidentAction) error }
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func (*Monitor) CheckInterval ¶
func (*Monitor) CheckResults ¶
func (m *Monitor) CheckResults() []CheckResult
func (*Monitor) EndpointUrl ¶
func (*Monitor) HasIncidentUnresolved ¶
func (*Monitor) IncidentUnresolved ¶
func (*Monitor) IsEndpointUp ¶
func (*Monitor) LastCheckedAt ¶
func (*Monitor) MarkEndpointAsDown ¶
func (m *Monitor) MarkEndpointAsDown()
func (*Monitor) MarkEndpointAsUp ¶
func (m *Monitor) MarkEndpointAsUp()
func (*Monitor) SetEndpointCheckResult ¶
func (*Monitor) Subscribers ¶
func (m *Monitor) Subscribers() []*Subscriber
type Repository ¶
type Repository interface { Delete(ctx context.Context, ID domain.ID) error Insert(ctx context.Context, monitor *Monitor) error FindByID(ctx context.Context, ID domain.ID) (*Monitor, error) Update(ctx context.Context, ID domain.ID, fn func(monitor *Monitor) error) error UpdateForCheck(ctx context.Context, fn func(foundMonitors []*Monitor) error) error SaveCheckResult(ctx context.Context, ID domain.ID, checkResult *CheckResult) error }
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
func NewSubscriber ¶
func NewSubscriber(userID domain.ID) (*Subscriber, error)
func (*Subscriber) UserID ¶
func (s *Subscriber) UserID() domain.ID
Click to show internal directories.
Click to hide internal directories.