dashboard

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 12 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is the main builder used to configure dashboards.

func New

func New(title string, options ...Option) (Builder, error)

New creates a new dashboard builder.

func (*Builder) Alerts added in v0.21.0

func (builder *Builder) Alerts() []*alert.Alert

Alerts returns all the alerts defined in this dashboard.

func (*Builder) Internal

func (builder *Builder) Internal() *sdk.Board

Internal.

func (*Builder) MarshalIndentJSON added in v0.17.0

func (builder *Builder) MarshalIndentJSON() ([]byte, error)

MarshalIndentJSON renders the dashboard as indented JSON which your configuration management tool of choice can then feed into Grafana's dashboard via its provisioning support. See https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards

func (*Builder) MarshalJSON

func (builder *Builder) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface.

This method can be used to render the dashboard as JSON which your configuration management tool of choice can then feed into Grafana's dashboard via its provisioning support. See https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards

type DashboardLink struct {
	Title string
	Tags  []string

	AsDropdown            bool
	IncludeTimeRange      bool
	IncludeVariableValues bool
	OpenInNewTab          bool
}

DashboardLink describes dashboard-level links to other dashboards. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#dashboard-links

type ExternalLink struct {
	Title                 string
	Description           string
	URL                   string
	Icon                  LinkIcon
	IncludeTimeRange      bool
	IncludeVariableValues bool
	OpenInNewTab          bool
}

ExternalLink describes dashboard-level external link. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#add-a-url-link-to-a-dashboard

type LinkIcon added in v0.17.4

type LinkIcon string
const (
	IconExternal  LinkIcon = "external"
	IconDashboard LinkIcon = "dashboard"
	IconQuestion  LinkIcon = "question"
	IconInfo      LinkIcon = "info"
	IconBolt      LinkIcon = "bolt"
	IconDoc       LinkIcon = "doc"
	IconCloud     LinkIcon = "cloud"
)

type Option

type Option func(dashboard *Builder) error

Option represents an option that can be used to configure a dashboard.

func AutoRefresh

func AutoRefresh(interval string) Option

AutoRefresh defines the auto-refresh interval for the dashboard.

func DashboardLinks(links ...DashboardLink) Option

DashboardLinks adds a dashboard-level links to other dashboards. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#dashboard-links

func DefaultTooltip

func DefaultTooltip() Option

DefaultTooltip configures the graph tooltip NOT to be shared across panels.

func Editable

func Editable() Option

Editable marks the dashboard as editable.

func ExternalLinks(links ...ExternalLink) Option

ExternalLinks adds a dashboard-level external links. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#add-a-url-link-to-a-dashboard

func ID added in v0.5.1

func ID(id uint) Option

ID sets the ID used by the dashboard.

func ReadOnly

func ReadOnly() Option

ReadOnly marks the dashboard as non-editable.

func Row

func Row(title string, options ...row.Option) Option

Row adds a row to the dashboard.

func SharedCrossHair

func SharedCrossHair() Option

SharedCrossHair configures the graph tooltip to be shared across panels.

func Slug added in v0.21.13

func Slug(slug string) Option

Slug sets the Slug used by the dashboard.

func Tags

func Tags(tags []string) Option

Tags adds the given set of tags to the dashboard.

func TagsAnnotation

func TagsAnnotation(annotation TagAnnotation) Option

TagsAnnotation adds a new source of annotation for the dashboard.

func Time added in v0.7.0

func Time(from, to string) Option

Time defines the default time range for the dashboard, e.g. from "now-6h" to "now".

func Timezone added in v0.7.0

func Timezone(timezone TimezoneOption) Option

Timezone defines the default timezone for the dashboard, e.g. "utc".

func UID added in v0.5.1

func UID(uid string) Option

UID sets the UID used by the dashboard.

func VariableAsConst

func VariableAsConst(name string, options ...constant.Option) Option

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

VariableAsCustom adds a templated variable, defined as a set of custom values. See https://grafana.com/docs/grafana/latest/reference/templating/#variable-types

func VariableAsDatasource added in v0.12.9

func VariableAsDatasource(name string, options ...datasource.Option) Option

VariableAsDatasource adds a templated variable, defined as a datasource. See https://grafana.com/docs/grafana/latest/variables/variable-types/add-data-source-variable/

func VariableAsInterval

func VariableAsInterval(name string, options ...interval.Option) Option

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

VariableAsQuery adds a templated variable, defined as a query. See https://grafana.com/docs/grafana/latest/reference/templating/#variable-types

func VariableAsText added in v0.21.16

func VariableAsText(name string, options ...text.Option) Option

VariableAsText adds a templated variable, defined as a free text input. See https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#add-a-text-box-variable

type TagAnnotation

type TagAnnotation struct {
	Name       string
	Datasource string
	IconColor  string   `yaml:"color"`
	Tags       []string `yaml:",flow"`
}

TagAnnotation describes an annotation represented as a Tag. See https://grafana.com/docs/grafana/latest/reference/annotations/#query-by-tag

type TimezoneOption added in v0.7.0

type TimezoneOption string

TimezoneOption represents a possible value for the dashboard's timezone configuration.

const Browser TimezoneOption = "browser"

Browser sets the dashboard's timezone to the browser's one.

const DefaultTimezone TimezoneOption = ""

DefaultTimezone sets the dashboard's timezone to the default one used by Grafana.

const UTC TimezoneOption = "utc"

UTC sets the dashboard's timezone to UTC.

Jump to

Keyboard shortcuts

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