store

package
v5.11.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(cfg *storage.Config) error

Initialize instantiates the storage provider based on the Config provider

Types

type Store

type Store interface {
	// GetAllEndpointStatuses returns the JSON encoding of all monitored endpoint.Status
	// with a subset of endpoint.Result defined by the page and pageSize parameters
	GetAllEndpointStatuses(params *paging.EndpointStatusParams) ([]*endpoint.Status, error)

	// GetEndpointStatus returns the endpoint status for a given endpoint name in the given group
	GetEndpointStatus(groupName, endpointName string, params *paging.EndpointStatusParams) (*endpoint.Status, error)

	// GetEndpointStatusByKey returns the endpoint status for a given key
	GetEndpointStatusByKey(key string, params *paging.EndpointStatusParams) (*endpoint.Status, error)

	// GetUptimeByKey returns the uptime percentage during a time range
	GetUptimeByKey(key string, from, to time.Time) (float64, error)

	// GetAverageResponseTimeByKey returns the average response time in milliseconds (value) during a time range
	GetAverageResponseTimeByKey(key string, from, to time.Time) (int, error)

	// GetHourlyAverageResponseTimeByKey returns a map of hourly (key) average response time in milliseconds (value) during a time range
	GetHourlyAverageResponseTimeByKey(key string, from, to time.Time) (map[int64]int, error)

	// Insert adds the observed result for the specified endpoint into the store
	Insert(ep *endpoint.Endpoint, result *endpoint.Result) error

	// DeleteAllEndpointStatusesNotInKeys removes all Status that are not within the keys provided
	//
	// Used to delete endpoints that have been persisted but are no longer part of the configured endpoints
	DeleteAllEndpointStatusesNotInKeys(keys []string) int

	// GetTriggeredEndpointAlert returns whether the triggered alert for the specified endpoint as well as the necessary information to resolve it
	GetTriggeredEndpointAlert(ep *endpoint.Endpoint, alert *alert.Alert) (exists bool, resolveKey string, numberOfSuccessesInARow int, err error)

	// UpsertTriggeredEndpointAlert inserts/updates a triggered alert for an endpoint
	// Used for persistence of triggered alerts across application restarts
	UpsertTriggeredEndpointAlert(ep *endpoint.Endpoint, triggeredAlert *alert.Alert) error

	// DeleteTriggeredEndpointAlert deletes a triggered alert for an endpoint
	DeleteTriggeredEndpointAlert(ep *endpoint.Endpoint, triggeredAlert *alert.Alert) error

	// 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.
	DeleteAllTriggeredAlertsNotInChecksumsByEndpoint(ep *endpoint.Endpoint, checksums []string) int

	// Clear deletes everything from the store
	Clear()

	// Save persists the data if and where it needs to be persisted
	Save() error

	// Close terminates every connection and closes the store, if applicable.
	// Should only be used before stopping the application.
	Close()
}

Store is the interface that each store should implement

func Get

func Get() Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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