grafana

package
v0.0.0-...-c5fae6d Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Rows []struct {
		Panels []PanelConfig `json:"panels"`
		Repeat string        `json:"repeat"`
		Title  string        `json:"title"`
	} `json:"rows"`
	Templating struct {
		List []struct {
			Name  string `json:"name"`
			Label string `json:"label"`
			Query string `json:"query"`
		} `json:"list"`
	} `json:"templating"`
}

Config is the Prometheus metrics config for the Grafana, We will parse the associated json file to this Config.

func ParseConfig

func ParseConfig(path string) (*Config, error)

ParseConfig parses the config from a JSON file.

func (*Config) LabelValues

func (c *Config) LabelValues() []LabelValue

LabelValues parse the templating to get the label values.

type LabelValue

type LabelValue struct {
	Query string
	Label string
	Name  string
}

LabelValue is used to get thet time series with the centain label. We will use this label value to replace the name configured in Grafana.

type PanelConfig

type PanelConfig struct {
	Targets []struct {
		Expr         string `json:"expr"`
		LegendFormat string `json:"legendFormat"`
	}
	Title string `json:"title"`
}

PanelConfig is for panel of the row.

Jump to

Keyboard shortcuts

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