image

package
v0.0.1-test Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 NoopImageService

type NoopImageService struct{}

NoopImageService is a no-op image service.

func (*NoopImageService) NewImage

type NotAvailableImageService

type NotAvailableImageService struct{}

NotAvailableImageService is a service that returns ErrScreenshotsUnavailable.

func (*NotAvailableImageService) NewImage

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

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 (*UploadingService) Upload

func (s *UploadingService) Upload(ctx context.Context, image ngmodels.Image) (ngmodels.Image, error)

Upload uploads an image and returns a new image with the unmodified path and a URL. It returns the unmodified image on error.

Jump to

Keyboard shortcuts

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