observabilityrules

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	SchemaVersion int    `json:"schema_version" yaml:"schema_version"`
	Backend       string `json:"backend" yaml:"backend"`
	Organization  string `json:"organization" yaml:"organization"`
	Rules         []Rule `json:"rules" yaml:"rules"`
}

func Load

func Load(path string) (Bundle, error)

func (Bundle) Validate

func (b Bundle) Validate() error

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 (*OpenObserveClient) Plan

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 OpenObserveValueCondition

type OpenObserveValueCondition struct {
	Column     string  `json:"column"`
	Operator   string  `json:"operator"`
	Value      float64 `json:"value"`
	IgnoreCase bool    `json:"ignore_case"`
}

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

func (r Rule) RequiredEvaluations() int

func (Rule) Validate

func (r Rule) Validate() error

Jump to

Keyboard shortcuts

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