Documentation
¶
Index ¶
- Variables
- type Client
- func (client *Client) CreateFolder(ctx context.Context, name string) (*Folder, error)
- func (client *Client) GetAlertChannelByName(ctx context.Context, name string) (*alert.Channel, error)
- func (client *Client) GetFolderByTitle(ctx context.Context, title string) (*Folder, error)
- func (client *Client) UpsertDashboard(ctx context.Context, folder *Folder, builder DashboardBuilder) (*Dashboard, error)
- type Dashboard
- type DashboardBuilder
- type DashboardBuilderOption
- func AutoRefresh(interval string) DashboardBuilderOption
- func DefaultTooltip() DashboardBuilderOption
- func Editable() DashboardBuilderOption
- func ReadOnly() DashboardBuilderOption
- func Row(title string, options ...row.Option) DashboardBuilderOption
- func SharedCrossHair() DashboardBuilderOption
- func Tags(tags []string) DashboardBuilderOption
- func TagsAnnotation(annotation TagAnnotation) DashboardBuilderOption
- func VariableAsConst(name string, options ...constant.Option) DashboardBuilderOption
- func VariableAsCustom(name string, options ...custom.Option) DashboardBuilderOption
- func VariableAsInterval(name string, options ...interval.Option) DashboardBuilderOption
- func VariableAsQuery(name string, options ...query.Option) DashboardBuilderOption
- type Folder
- type TagAnnotation
Constants ¶
This section is empty.
Variables ¶
var ErrAlertChannelNotFound = errors.New("alert channel not found")
ErrAlertChannelNotFound is returned when the given alert notification channel can not be found.
var ErrFolderNotFound = errors.New("folder not found")
ErrFolderNotFound is returned when the given folder can not be found.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Grafana HTTP client.
func (*Client) CreateFolder ¶
CreateFolder creates a dashboard folder. See https://grafana.com/docs/grafana/latest/reference/dashboard_folders/
func (*Client) GetAlertChannelByName ¶
func (client *Client) GetAlertChannelByName(ctx context.Context, name string) (*alert.Channel, error)
GetAlertChannelByName finds an alert notification channel, given its name.
func (*Client) GetFolderByTitle ¶
GetFolderByTitle finds a folder, given its title.
func (*Client) UpsertDashboard ¶
func (client *Client) UpsertDashboard(ctx context.Context, folder *Folder, builder DashboardBuilder) (*Dashboard, error)
UpsertDashboard creates or replaces a dashboard, in the given folder.
type DashboardBuilder ¶
type DashboardBuilder struct {
// contains filtered or unexported fields
}
DashboardBuilder is the main builder used to configure dashboards.
func NewDashboardBuilder ¶
func NewDashboardBuilder(title string, options ...DashboardBuilderOption) DashboardBuilder
NewDashboardBuilder creates a new dashboard builder.
type DashboardBuilderOption ¶
type DashboardBuilderOption func(dashboard *DashboardBuilder)
DashboardBuilderOption represents an option that can be used to configure a dashboard.
func AutoRefresh ¶
func AutoRefresh(interval string) DashboardBuilderOption
AutoRefresh defines the auto-refresh interval for the dashboard.
func DefaultTooltip ¶
func DefaultTooltip() DashboardBuilderOption
DefaultTooltip configures the graph tooltip NOT to be shared across panels.
func ReadOnly ¶
func ReadOnly() DashboardBuilderOption
ReadOnly marks the dashboard as non-editable.
func Row ¶
func Row(title string, options ...row.Option) DashboardBuilderOption
Row adds a row to the dashboard.
func SharedCrossHair ¶
func SharedCrossHair() DashboardBuilderOption
SharedCrossHair configures the graph tooltip to be shared across panels.
func Tags ¶
func Tags(tags []string) DashboardBuilderOption
Tags adds the given set of tags to the dashboard.
func TagsAnnotation ¶
func TagsAnnotation(annotation TagAnnotation) DashboardBuilderOption
TagsAnnotation adds a new source of annotation for the dashboard.
func VariableAsConst ¶
func VariableAsConst(name string, options ...constant.Option) DashboardBuilderOption
VariableAsConst adds a templated variable, defined as a set of constant values. See https://grafana.com/docs/grafana/latest/reference/templating/#variable-types
func VariableAsCustom ¶
func VariableAsCustom(name string, options ...custom.Option) DashboardBuilderOption
VariableAsCustom adds a templated variable, defined as a set of custom values. See https://grafana.com/docs/grafana/latest/reference/templating/#variable-types
func VariableAsInterval ¶
func VariableAsInterval(name string, options ...interval.Option) DashboardBuilderOption
VariableAsInterval adds a templated variable, defined as an interval. See https://grafana.com/docs/grafana/latest/reference/templating/#variable-types
func VariableAsQuery ¶
func VariableAsQuery(name string, options ...query.Option) DashboardBuilderOption
VariableAsQuery adds a templated variable, defined as a query. See https://grafana.com/docs/grafana/latest/reference/templating/#variable-types
type Folder ¶
Folder represents a dashboard folder. See https://grafana.com/docs/grafana/latest/reference/dashboard_folders/
type TagAnnotation ¶
TagAnnotation describes an annotation represented as a Tag. See https://grafana.com/docs/grafana/latest/reference/annotations/#query-by-tag