grafana

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationRun     = "run"
	AnnotationExit    = "exit"
	AnnotationFailure = "failure"
)

Variables

View Source
var AnnotationTimeout = 30 * time.Second
View Source
var (
	Assertor *regexp.Regexp
)

Functions

func ConvertEvaluatorAlias

func ConvertEvaluatorAlias(alias string) string

func NewGrafanaClient

func NewGrafanaClient(ctx context.Context, r logr.Logger, apiURI string, setters ...Option) error

Types

type Alert

type Alert struct {
	Name string

	Message string

	Metric

	TimeRange

	Query
}

func NewAlert

func NewAlert(query string) (*Alert, error)

type Annotation

type Annotation interface {
	// Add  pushes an annotation to grafana indicating that a new component has joined the experiment.
	Add(obj client.Object)

	// Delete pushes an annotation to grafana indicating that a new component has left the experiment.
	Delete(obj client.Object)
}

Annotation provides a way to mark points on the graph with rich events. // When you hover over an annotation you can get event description and event tags. // The text field can include links to other systems with more detail.

type Client

type Client struct {
	Conn *sdk.Client
	// contains filtered or unexported fields
}
var DefaultClient *Client

func (*Client) PatchAnnotation

func (c *Client) PatchAnnotation(reqID uint, ga sdk.PatchAnnotationRequest)

PatchAnnotation updates an existing annotation to Grafana.

func (*Client) SetAlert

func (c *Client) SetAlert(alert *Alert) (uint, error)

SetAlert adds a new alert to Grafana.

func (*Client) SetAnnotation

func (c *Client) SetAnnotation(ga sdk.CreateAnnotationRequest) (reqID uint)

SetAnnotation inserts a new annotation to Grafana.

func (*Client) SetNotificationChannel

func (c *Client) SetNotificationChannel(webhookPort string, cb func(b *notifier.Body)) error

func (*Client) UnsetAlert

func (c *Client) UnsetAlert(alertID string)

UnsetAlert removes an alert from Grafana.

type Metric

type Metric struct {
	DashboardUID string

	PanelID uint

	MetricName string
}

Metric points to the Grafana metric we are interested in. The location can retrieved from the Grafana URL. Example: URL: http://grafana.platform.science-hangar.eu/d/wpFnYRwGk/iperf?orgId=1&viewPanel=2 Metric: wpFnYRwGk/2/bitrate

type Option

type Option func(*Options)

func WithNotifyOnAlert

func WithNotifyOnAlert(cb func(b *notifier.Body)) Option

WithNotifyOnAlert will update the object's annotations if a Grafana alert is triggered

type Options

type Options struct {
	NotifyOnAlert func(b *notifier.Body)
}

type PointAnnotation

type PointAnnotation struct{}

func (*PointAnnotation) Add

func (a *PointAnnotation) Add(obj client.Object)

func (*PointAnnotation) Delete

func (a *PointAnnotation) Delete(obj client.Object)

type Query

type Query struct {
	/* == Evaluator
	* below
	* above
	* within_range
	* outside_range
	* empty
	 */
	Evaluator sdk.AlertEvaluator

	/* == Reducers
	* avg
	* min
	* max
	* sum
	 */
	Reducer sdk.AlertReducer
}

type RangeAnnotation

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

RangeAnnotation uses range annotations to indicate the duration of a Chaos. It consists of two parts. In the first part, a failure annotation is created with open end. When a new value is pushed to the timeEnd channel, the annotation is updated accordingly. TimeEnd channel can be used as many times as wished. The client is responsible to close the channel.

func (*RangeAnnotation) Add

func (a *RangeAnnotation) Add(obj client.Object)

func (*RangeAnnotation) Delete

func (a *RangeAnnotation) Delete(obj client.Object)

type TimeRange

type TimeRange struct {
	From string
	To   string
}

Jump to

Keyboard shortcuts

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