Documentation ¶
Overview ¶
Package image is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheService ¶
type CacheService interface { // Get returns the screenshot for the options or false if a screenshot with these // options does not exist. Get(ctx context.Context, k string) (models.Image, bool) // Set the screenshot for the options. If another screenshot exists with these // options then it will be replaced. Set(ctx context.Context, k string, image models.Image) error }
CacheService caches images.
func NewInmemCacheService ¶
func NewInmemCacheService(expiration time.Duration, r prometheus.Registerer) CacheService
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( cache CacheService, limiter screenshot.RateLimiter, logger log.Logger, screenshots screenshot.ScreenshotService, screenshotTimeout time.Duration, 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 InmemCacheService ¶
type InmemCacheService struct {
// contains filtered or unexported fields
}
InmemCacheService is an in-mem screenshot cache.
type MockCacheService ¶
type MockCacheService struct {
// contains filtered or unexported fields
}
MockCacheService is a mock of CacheService interface.
func NewMockCacheService ¶
func NewMockCacheService(ctrl *gomock.Controller) *MockCacheService
NewMockCacheService creates a new mock instance.
func (*MockCacheService) EXPECT ¶
func (m *MockCacheService) EXPECT() *MockCacheServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockCacheServiceMockRecorder ¶
type MockCacheServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockCacheServiceMockRecorder is the mock recorder for MockCacheService.
func (*MockCacheServiceMockRecorder) Get ¶
func (mr *MockCacheServiceMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockCacheServiceMockRecorder) Set ¶
func (mr *MockCacheServiceMockRecorder) Set(arg0, arg1, arg2 interface{}) *gomock.Call
Set indicates an expected call of Set.
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, a models.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 a models.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