Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoDashboard is returned when the alert rule does not have a Dashboard UID // in its annotations or the dashboard does not exist. ErrNoDashboard = errors.New("no dashboard") // ErrNoPanel is returned when the alert rule does not have a PanelID in its // annotations. ErrNoPanel = errors.New("no panel") )
Functions ¶
This section is empty.
Types ¶
type DeleteExpiredService ¶
type DeleteExpiredService struct {
// contains filtered or unexported fields
}
DeleteExpiredService is a service to delete expired images.
func ProvideDeleteExpiredService ¶
func ProvideDeleteExpiredService(store *store.DBstore) *DeleteExpiredService
func (*DeleteExpiredService) DeleteExpired ¶
func (s *DeleteExpiredService) DeleteExpired(ctx context.Context) (int64, error)
type ImageService ¶
type ImageService interface { // NewImage returns a new image for the alert instance. NewImage(ctx context.Context, r *models.AlertRule) (*models.Image, error) }
func NewScreenshotImageService ¶
func NewScreenshotImageService( limiter screenshot.RateLimiter, logger log.Logger, screenshots screenshot.ScreenshotService, store store.ImageStore, uploads *UploadingService) ImageService
NewScreenshotImageService returns a new ScreenshotImageService.
func NewScreenshotImageServiceFromCfg ¶
func NewScreenshotImageServiceFromCfg(cfg *setting.Cfg, db *store.DBstore, ds dashboards.DashboardService, rs rendering.Service, r prometheus.Registerer) (ImageService, error)
NewScreenshotImageServiceFromCfg returns a new ScreenshotImageService from the configuration.
type NotAvailableImageService ¶
type NotAvailableImageService struct{}
NotAvailableImageService is a service that returns ErrScreenshotsUnavailable.
type ScreenshotImageService ¶
type ScreenshotImageService struct {
// contains filtered or unexported fields
}
ScreenshotImageService takes screenshots of the alert rule and saves the image in the store. The image contains a unique token that can be passed as an annotation or label to the Alertmanager. This service cannot take screenshots of alert rules that are not associated with a dashboard panel.
func (*ScreenshotImageService) NewImage ¶
func (s *ScreenshotImageService) NewImage(ctx context.Context, r *models.AlertRule) (*models.Image, error)
NewImage returns a screenshot of the alert rule or an error.
The alert rule must be associated with a dashboard panel for a screenshot to be taken. If the alert rule does not have a Dashboard UID in its annotations, or the dashboard does not exist, an ErrNoDashboard error is returned. If the alert rule has a Dashboard UID and the dashboard exists, but does not have a Panel ID in its annotations then an ErrNoPanel error is returned.
type UploadingService ¶
type UploadingService struct {
// contains filtered or unexported fields
}
func NewUploadingService ¶
func NewUploadingService(uploader imguploader.ImageUploader, r prometheus.Registerer) *UploadingService