sql

package
v5.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPathNotSpecified is the error returned when the path parameter passed in NewStore is blank
	ErrPathNotSpecified = errors.New("path cannot be empty")

	// ErrDatabaseDriverNotSpecified is the error returned when the driver parameter passed in NewStore is blank
	ErrDatabaseDriverNotSpecified = errors.New("database driver cannot be empty")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store that leverages a database

func NewStore

func NewStore(driver, path string, caching bool) (*Store, error)

NewStore initializes the database and creates the schema if it doesn't already exist in the path specified

func (*Store) Clear

func (s *Store) Clear()

Clear deletes everything from the store

func (*Store) Close

func (s *Store) Close()

Close the database handle

func (*Store) DeleteAllEndpointStatusesNotInKeys

func (s *Store) DeleteAllEndpointStatusesNotInKeys(keys []string) int

DeleteAllEndpointStatusesNotInKeys removes all rows owned by an endpoint whose key is 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.

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

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

func (s *Store) GetAverageResponseTimeByKey(key string, from, to time.Time) (int, error)

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

func (*Store) GetUptimeByKey

func (s *Store) GetUptimeByKey(key string, from, to time.Time) (float64, error)

GetUptimeByKey returns the uptime percentage during a time range

func (*Store) Insert

func (s *Store) Insert(ep *endpoint.Endpoint, result *endpoint.Result) error

Insert adds the observed result for the specified endpoint into the store

func (*Store) Save

func (s *Store) Save() error

Save does nothing, because this store is immediately persistent.

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

Jump to

Keyboard shortcuts

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