dashboards

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

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 {
	HasDashboardSources() bool
	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, provisioner dashboards.DashboardProvisioningService, orgService org.Service, dashboardStore utils.DashboardStore) (DashboardProvisioner, error)

New returns a new DashboardProvisioner

type DashboardProvisionerFactory

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, service dashboards.DashboardProvisioningService, dashboardStore utils.DashboardStore) (*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 its external_id.

func (*Provisioner) HasDashboardSources

func (provider *Provisioner) HasDashboardSources() bool

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) HasDashboardSources

func (dpm *ProvisionerMock) HasDashboardSources() bool

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