dashboards

package
v0.0.0-test Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: AGPL-3.0 Imports: 20 Imported by: 95

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFolderNameMissing is returned when folder name is missing.
	ErrFolderNameMissing = errors.New("folder name missing")
)

Functions

This section is empty.

Types

type DashboardProvisioner

type DashboardProvisioner interface {
	Provision(ctx context.Context) error
	PollChanges(ctx context.Context)
	GetProvisionerResolvedPath(name string) string
	GetAllowUIUpdatesFromConfig(name string) bool
	CleanUpOrphanedDashboards(ctx context.Context)
}

DashboardProvisioner is responsible for syncing dashboard from disk to Grafana's database.

func New

func New(ctx context.Context, configDirectory string, store dashboards.Store) (DashboardProvisioner, error)

New returns a new DashboardProvisioner

type DashboardProvisionerFactory

type DashboardProvisionerFactory func(context.Context, string, dashboards.Store) (DashboardProvisioner, error)

DashboardProvisionerFactory creates DashboardProvisioners based on input

type FileReader

type FileReader struct {
	Cfg  *config
	Path string

	FoldersFromFilesStructure bool
	// contains filtered or unexported fields
}

FileReader is responsible for reading dashboards from disk and insert/update dashboards to the Grafana database using `dashboards.DashboardProvisioningService`.

func NewDashboardFileReader

func NewDashboardFileReader(cfg *config, log log.Logger, store dboards.Store) (*FileReader, error)

NewDashboardFileReader returns a new filereader based on `config`

type Provisioner

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

Provisioner is responsible for syncing dashboard from disk to Grafana's database.

func (*Provisioner) CleanUpOrphanedDashboards

func (provider *Provisioner) CleanUpOrphanedDashboards(ctx context.Context)

CleanUpOrphanedDashboards deletes provisioned dashboards missing a linked reader.

func (*Provisioner) GetAllowUIUpdatesFromConfig

func (provider *Provisioner) GetAllowUIUpdatesFromConfig(name string) bool

GetAllowUIUpdatesFromConfig return if a dashboard provisioner allows updates from the UI

func (*Provisioner) GetProvisionerResolvedPath

func (provider *Provisioner) GetProvisionerResolvedPath(name string) string

GetProvisionerResolvedPath returns resolved path for the specified provisioner name. Can be used to generate relative path to provisioning file from it's external_id.

func (*Provisioner) PollChanges

func (provider *Provisioner) PollChanges(ctx context.Context)

PollChanges starts polling for changes in dashboard definition files. It creates a goroutine for each provider defined in the config.

func (*Provisioner) Provision

func (provider *Provisioner) Provision(ctx context.Context) error

Provision scans the disk for dashboards and updates the database with the latest versions of those dashboards.

type ProvisionerMock

type ProvisionerMock struct {
	Calls                           *calls
	ProvisionFunc                   func(ctx context.Context) error
	PollChangesFunc                 func(ctx context.Context)
	GetProvisionerResolvedPathFunc  func(name string) string
	GetAllowUIUpdatesFromConfigFunc func(name string) bool
}

ProvisionerMock is a mock implementation of `Provisioner`

func NewDashboardProvisionerMock

func NewDashboardProvisionerMock() *ProvisionerMock

NewDashboardProvisionerMock returns a new dashboardprovisionermock

func (*ProvisionerMock) CleanUpOrphanedDashboards

func (dpm *ProvisionerMock) CleanUpOrphanedDashboards(ctx context.Context)

CleanUpOrphanedDashboards not implemented for mocks

func (*ProvisionerMock) GetAllowUIUpdatesFromConfig

func (dpm *ProvisionerMock) GetAllowUIUpdatesFromConfig(name string) bool

GetAllowUIUpdatesFromConfig is a mock implementation of `Provisioner.GetAllowUIUpdatesFromConfig`

func (*ProvisionerMock) GetProvisionerResolvedPath

func (dpm *ProvisionerMock) GetProvisionerResolvedPath(name string) string

GetProvisionerResolvedPath is a mock implementation of `Provisioner.GetProvisionerResolvedPath`

func (*ProvisionerMock) PollChanges

func (dpm *ProvisionerMock) PollChanges(ctx context.Context)

PollChanges is a mock implementation of `Provisioner.PollChanges`

func (*ProvisionerMock) Provision

func (dpm *ProvisionerMock) Provision(ctx context.Context) error

Provision is a mock implementation of `Provisioner.Provision`

Jump to

Keyboard shortcuts

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