Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertEvaluatorAlias(alias string) string
- func NewGrafanaClient(ctx context.Context, r logr.Logger, apiURI string, setters ...Option) error
- type Alert
- type Annotation
- type Client
- func (c *Client) PatchAnnotation(reqID uint, ga sdk.PatchAnnotationRequest)
- func (c *Client) SetAlert(alert *Alert, name string, msg string) (uint, error)
- func (c *Client) SetAnnotation(ga sdk.CreateAnnotationRequest) (reqID uint)
- func (c *Client) SetNotificationChannel(webhookPort string, cb func(b *notifier.Body)) error
- func (c *Client) UnsetAlert(alertID string)
- type Execution
- type Metric
- type Option
- type Options
- type PointAnnotation
- type Query
- type RangeAnnotation
- type Tag
- type TimeRange
Constants ¶
const ( DefaultEvaluationFrequency = "1m" DefaultStabilityWindow = "0s" )
const ( TagRun = "run" TagExit = "exit" TagFailure = "failure" )
Variables ¶
var AnnotationTimeout = 30 * time.Second
var Assertor = regexp.MustCompile(`(?m)^(?P<reducer>\w+)\(\)\s+of\s+query\((?P<dashboardUID>\w+)\/(?P<panelID>\d+)\/(?P<metric>\w+),\s+(?P<from>\w+),\s+(?P<to>\w+)\)\s+is\s+(?P<evaluator>\w+)\((?P<params>\d*[,\s]*\d*)\)\s*(for\((?P<for>\w+)\))*\s*(every\((?P<every>\w+)\))*\s*$`)
Assertor expressions evaluated with https://regex101.com/r/xrSyEz/1
Functions ¶
func ConvertEvaluatorAlias ¶
Types ¶
type Alert ¶
func ParseAlertExpr ¶ added in v1.0.16
func ParseAlertExpr(query v1alpha1.ExprMetrics) (*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. // Conditions 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 ¶
var DefaultClient *Client
func (*Client) PatchAnnotation ¶
func (c *Client) PatchAnnotation(reqID uint, ga sdk.PatchAnnotationRequest)
PatchAnnotation updates an existing annotation 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 (*Client) UnsetAlert ¶
UnsetAlert removes an alert from Grafana.
type Metric ¶
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 ¶
WithNotifyOnAlert will update the object's annotations if a Grafana alert is triggered
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 * count * last * median * diff * diff_abs * percent_diff * percent_diff_abs * count_non_null */ 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. Conditions 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.