Documentation
¶
Index ¶
Constants ¶
View Source
const SchemaVersion = 2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type OpenObserveAlert ¶
type OpenObserveAlert struct {
Name string `json:"name"`
OrgID string `json:"org_id"`
StreamType string `json:"stream_type"`
StreamName string `json:"stream_name"`
IsRealTime bool `json:"is_real_time"`
QueryCondition OpenObserveQuery `json:"query_condition"`
TriggerCondition OpenObserveTrigger `json:"trigger_condition"`
Destinations []string `json:"destinations"`
ContextAttributes map[string]string `json:"context_attributes"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
TZOffset int `json:"tz_offset"`
CreatesIncident bool `json:"creates_incident"`
Priority int `json:"priority"`
Tags []string `json:"tags"`
}
type OpenObserveBundle ¶
type OpenObserveBundle struct {
SchemaVersion int `json:"schema_version"`
Organization string `json:"organization"`
Destination string `json:"destination"`
Alerts []OpenObserveAlert `json:"alerts"`
}
func RenderOpenObserve ¶
func RenderOpenObserve(bundle Bundle, destination string, enable bool) (OpenObserveBundle, error)
type OpenObserveClient ¶
type OpenObserveClient struct {
Endpoint *url.URL
Username string
Password string
HTTPClient *http.Client
}
func NewOpenObserveClient ¶
func NewOpenObserveClient(endpoint, username, password string) (*OpenObserveClient, error)
func (*OpenObserveClient) Apply ¶
func (c *OpenObserveClient) Apply(ctx context.Context, desired OpenObserveBundle) (ReconcilePlan, error)
func (*OpenObserveClient) Plan ¶
func (c *OpenObserveClient) Plan(ctx context.Context, desired OpenObserveBundle) (ReconcilePlan, error)
type OpenObserveQuery ¶
type OpenObserveQuery struct {
Type string `json:"type"`
PromQL string `json:"promql"`
PromQLCondition OpenObserveValueCondition `json:"promql_condition"`
PromQLMultiAlert bool `json:"promql_multi_alert"`
}
type OpenObserveTrigger ¶
type OpenObserveTrigger struct {
Period int `json:"period"`
Operator string `json:"operator"`
Threshold int `json:"threshold"`
Frequency int `json:"frequency"`
FrequencyType string `json:"frequency_type"`
Silence int `json:"silence"`
Timezone string `json:"timezone"`
ToleranceInSecs int `json:"tolerance_in_secs"`
AlignTime bool `json:"align_time"`
}
type ReconcileAction ¶
type ReconcileAction struct {
Kind string `json:"kind"`
Name string `json:"name"`
AlertID string `json:"alert_id,omitempty"`
Desired *OpenObserveAlert `json:"desired,omitempty"`
}
type ReconcilePlan ¶
type ReconcilePlan struct {
SchemaVersion int `json:"schema_version"`
State string `json:"state"`
Organization string `json:"organization"`
Destination string `json:"destination"`
DestinationPresent bool `json:"destination_present"`
MissingStreams []string `json:"missing_streams"`
Actions []ReconcileAction `json:"actions"`
}
type Rule ¶
type Rule struct {
ID string `json:"id" yaml:"id"`
Severity string `json:"severity" yaml:"severity"`
QueryLanguage string `json:"query_language" yaml:"query_language"`
StreamName string `json:"stream_name" yaml:"stream_name"`
Expression string `json:"expression" yaml:"expression"`
Operator string `json:"operator" yaml:"operator"`
Threshold float64 `json:"threshold" yaml:"threshold"`
EvaluationSecs int `json:"evaluation_seconds" yaml:"evaluation_seconds"`
HoldSecs int `json:"hold_seconds" yaml:"hold_seconds"`
DestinationRef string `json:"destination_ref" yaml:"destination_ref"`
Enabled bool `json:"enabled" yaml:"enabled"`
Owner string `json:"owner" yaml:"owner"`
Runbook string `json:"runbook" yaml:"runbook"`
Summary string `json:"summary" yaml:"summary"`
Action string `json:"action" yaml:"action"`
Recovery string `json:"recovery" yaml:"recovery"`
}
func (Rule) RequiredEvaluations ¶
Click to show internal directories.
Click to hide internal directories.