Documentation ¶
Index ¶
- func AddResult(ss *endpoint.Status, result *endpoint.Result)
- func ShallowCopyEndpointStatus(ss *endpoint.Status, params *paging.EndpointStatusParams) *endpoint.Status
- type Store
- func (s *Store) Clear()
- func (s *Store) Close()
- func (s *Store) DeleteAllEndpointStatusesNotInKeys(keys []string) int
- func (s *Store) DeleteAllTriggeredAlertsNotInChecksumsByEndpoint(ep *endpoint.Endpoint, checksums []string) int
- func (s *Store) DeleteTriggeredEndpointAlert(ep *endpoint.Endpoint, triggeredAlert *alert.Alert) error
- func (s *Store) GetAllEndpointStatuses(params *paging.EndpointStatusParams) ([]*endpoint.Status, error)
- func (s *Store) GetAverageResponseTimeByKey(key string, from, to time.Time) (int, error)
- func (s *Store) GetEndpointStatus(groupName, endpointName string, params *paging.EndpointStatusParams) (*endpoint.Status, error)
- func (s *Store) GetEndpointStatusByKey(key string, params *paging.EndpointStatusParams) (*endpoint.Status, error)
- func (s *Store) GetHourlyAverageResponseTimeByKey(key string, from, to time.Time) (map[int64]int, error)
- func (s *Store) GetTriggeredEndpointAlert(ep *endpoint.Endpoint, alert *alert.Alert) (exists bool, resolveKey string, numberOfSuccessesInARow int, err error)
- func (s *Store) GetUptimeByKey(key string, from, to time.Time) (float64, error)
- func (s *Store) Insert(ep *endpoint.Endpoint, result *endpoint.Result) error
- func (s *Store) Save() error
- func (s *Store) UpsertTriggeredEndpointAlert(ep *endpoint.Endpoint, triggeredAlert *alert.Alert) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResult ¶
AddResult adds a Result to Status.Results and makes sure that there are no more than MaximumNumberOfResults results in the Results slice
func ShallowCopyEndpointStatus ¶
func ShallowCopyEndpointStatus(ss *endpoint.Status, params *paging.EndpointStatusParams) *endpoint.Status
ShallowCopyEndpointStatus returns a shallow copy of a Status with only the results within the range defined by the page and pageSize parameters
Types ¶
type Store ¶
Store that leverages gocache
func NewStore ¶
NewStore creates a new store using gocache.Cache
This store holds everything in memory, and if the file parameter is not blank, supports eventual persistence.
func (*Store) DeleteAllEndpointStatusesNotInKeys ¶
DeleteAllEndpointStatusesNotInKeys removes all Status that are not within the keys provided
func (*Store) DeleteAllTriggeredAlertsNotInChecksumsByEndpoint ¶ added in v5.11.0
func (s *Store) DeleteAllTriggeredAlertsNotInChecksumsByEndpoint(ep *endpoint.Endpoint, checksums []string) int
DeleteAllTriggeredAlertsNotInChecksumsByEndpoint removes all triggered alerts owned by an endpoint whose alert configurations are not provided in the checksums list. This prevents triggered alerts that have been removed or modified from lingering in the database.
Does nothing for the in-memory store since it does not support persistence across restarts
func (*Store) DeleteTriggeredEndpointAlert ¶ added in v5.11.0
func (s *Store) DeleteTriggeredEndpointAlert(ep *endpoint.Endpoint, triggeredAlert *alert.Alert) error
DeleteTriggeredEndpointAlert deletes a triggered alert for an endpoint
Does nothing for the in-memory store since it does not support persistence across restarts
func (*Store) GetAllEndpointStatuses ¶
func (s *Store) GetAllEndpointStatuses(params *paging.EndpointStatusParams) ([]*endpoint.Status, error)
GetAllEndpointStatuses returns all monitored endpoint.Status with a subset of endpoint.Result defined by the page and pageSize parameters
func (*Store) GetAverageResponseTimeByKey ¶
GetAverageResponseTimeByKey returns the average response time in milliseconds (value) during a time range
func (*Store) GetEndpointStatus ¶
func (s *Store) GetEndpointStatus(groupName, endpointName string, params *paging.EndpointStatusParams) (*endpoint.Status, error)
GetEndpointStatus returns the endpoint status for a given endpoint name in the given group
func (*Store) GetEndpointStatusByKey ¶
func (s *Store) GetEndpointStatusByKey(key string, params *paging.EndpointStatusParams) (*endpoint.Status, error)
GetEndpointStatusByKey returns the endpoint status for a given key
func (*Store) GetHourlyAverageResponseTimeByKey ¶
func (s *Store) GetHourlyAverageResponseTimeByKey(key string, from, to time.Time) (map[int64]int, error)
GetHourlyAverageResponseTimeByKey returns a map of hourly (key) average response time in milliseconds (value) during a time range
func (*Store) GetTriggeredEndpointAlert ¶ added in v5.11.0
func (s *Store) GetTriggeredEndpointAlert(ep *endpoint.Endpoint, alert *alert.Alert) (exists bool, resolveKey string, numberOfSuccessesInARow int, err error)
GetTriggeredEndpointAlert returns whether the triggered alert for the specified endpoint as well as the necessary information to resolve it
Always returns that the alert does not exist for the in-memory store since it does not support persistence across restarts
func (*Store) GetUptimeByKey ¶
GetUptimeByKey returns the uptime percentage during a time range
func (*Store) UpsertTriggeredEndpointAlert ¶ added in v5.11.0
func (s *Store) UpsertTriggeredEndpointAlert(ep *endpoint.Endpoint, triggeredAlert *alert.Alert) error
UpsertTriggeredEndpointAlert inserts/updates a triggered alert for an endpoint Used for persistence of triggered alerts across application restarts
Does nothing for the in-memory store since it does not support persistence across restarts