variables

package
v0.2.6-alpha1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GrafanaFuncLabelNamesFuncName is the label_names function name in Grafana
	GrafanaFuncLabelNamesFuncName = "label_names"

	// GrafanaFuncLabelValuesFuncName is the label_values function name in Grafana
	GrafanaFuncLabelValuesFuncName = "label_values"

	// GrafanaFuncMetricNamesFuncName is the metrics function name in Grafana
	GrafanaFuncMetricNamesFuncName = "metrics"

	// GrafanaFuncQueryResultFuncName is the query_result function name in Grafana
	GrafanaFuncQueryResultFuncName = "query_result"
)

Variables

View Source
var (
	// GrafanaFuncLabelNamesRegex is the label_names function in Grafana
	GrafanaFuncLabelNamesRegex = regexp.MustCompile(`^label_names\(\)\s*$`)

	// GrafanaFuncLabelNamesRegexWithMatch is the label_names function in Grafana
	GrafanaFuncLabelNamesRegexWithMatch = regexp.MustCompile(`^label_names\((.+)\)\s*$`)

	// GrafanaFuncLabelValuesRegex is the label_values function in Grafana
	GrafanaFuncLabelValuesRegex = regexp.MustCompile(`^label_values\((?:(.+),\s*)?([a-zA-Z_$][a-zA-Z0-9_]*)\)\s*$`)

	// GrafanaFuncMetricNamesRegex is the metrics function in Grafana
	GrafanaFuncMetricNamesRegex = regexp.MustCompile(`^metrics\((.+)\)\s*$`)

	// GrafanaFuncQueryResultRegex is the query_result function in Grafana
	GrafanaFuncQueryResultRegex = regexp.MustCompile(`^query_result\((.+)\)\s*$`)
)

Functions

This section is empty.

Types

type Addon

type Addon struct {
	Measurement string
}

func (*Addon) BuildVariables

func (addon *Addon) BuildVariables(variables []grafanaspec.VariableModel) ([]any, error)

BuildVariables builds variables for Guance Cloud All the function is described in https://github.com/grafana/grafana/blob/72d32eed27c058467aba8e02077b5b2e97c61c8d/public/app/plugins/datasource/prometheus/migrations/variableMigration.ts#L5

func (*Addon) PatchDashboard

func (addon *Addon) PatchDashboard(spec *grafanaspec.Spec, dashboard map[string]any) (map[string]any, error)

type GrafanaFuncLabelNames added in v0.2.3

type GrafanaFuncLabelNames struct {
	MetricRegexp string
}

GrafanaFuncLabelNames is the label_names function in Grafana

func (*GrafanaFuncLabelNames) ToGuance added in v0.2.6

func (v *GrafanaFuncLabelNames) ToGuance() string

type GrafanaFuncLabelValues added in v0.2.3

type GrafanaFuncLabelValues struct {
	Measurement string
	Metric      string
	Label       string
}

GrafanaFuncLabelValues is the label_values function in Grafana

func (*GrafanaFuncLabelValues) ToGuance added in v0.2.6

func (v *GrafanaFuncLabelValues) ToGuance() string

type GrafanaFuncMetrics added in v0.2.3

type GrafanaFuncMetrics struct {
	MetricRegexp string
}

GrafanaFuncMetrics is the metrics function in Grafana

func (*GrafanaFuncMetrics) ToGuance added in v0.2.6

func (v *GrafanaFuncMetrics) ToGuance() string

type GrafanaFuncQueryResult added in v0.2.3

type GrafanaFuncQueryResult struct {
	Measurement string
	Query       string
}

GrafanaFuncQueryResult is the query_result function in Grafana

func (*GrafanaFuncQueryResult) ToGuance added in v0.2.6

func (v *GrafanaFuncQueryResult) ToGuance() string

type GrafanaVariable added in v0.2.3

type GrafanaVariable struct {
	Expr        string
	Measurement string
}

GrafanaVariable is a struct to represent a variable load from Grafana

func (*GrafanaVariable) Func added in v0.2.3

type GrafanaVariableFunc added in v0.2.6

type GrafanaVariableFunc interface {
	ToGuance() string
}

Jump to

Keyboard shortcuts

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