grafana

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderDashboard

func RenderDashboard(body []byte, vars RenderVars) ([]byte, error)

RenderDashboard will render the Grafana dashboard with variables.

func RenderDashboardWithTemplate

func RenderDashboardWithTemplate(config UpdateConfig, vars RenderVars) error

RenderDashboardWithTemplate renders the grafana dashboard with predefined variables statically. It's similar to the normal grafana dashboard rendering but it will support alerts with template variables.

Types

type RenderVars

type RenderVars []Var

RenderVars is the variables used to render the Grafana dashboard

func (RenderVars) GetGlobalContext

func (vars RenderVars) GetGlobalContext() map[string]string

GetGlobalContext returns the global context made by the name-value pairs, if the var has multiple values, pick the first one.

func (RenderVars) GetValues

func (vars RenderVars) GetValues(name string) ([]Val, error)

type UpdateConfig

type UpdateConfig struct {
	APIUrl       string `json:"apiUrl"`
	DashboardUID string `json:"dashboardUID"`
	BasicAuth    string `json:"basicAuth"`
}

type Val

type Val struct {
	Value   string            `json:"value"`
	Context map[string]string `json:"context"`
}

type Var

type Var struct {
	Name   string `json:"name"`
	Values []Val  `json:"values"`
}

Jump to

Keyboard shortcuts

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