rule

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilObject       = errors.New("there is something wrong with the object in the resource pool")
	ErrParameter       = errors.New("parameter error")
	ErrNotYetSupported = errors.New("not yet supported")
)

Functions

func NewFileSystem

func NewFileSystem(params *Params) (*fileSystem, error)

func NewK8sConfigMap

func NewK8sConfigMap(params *Params) (*k8sConfigMap, error)

func NewK8sOperator

func NewK8sOperator(params *Params) (*k8sOperator, error)

Types

type Component

type Component interface {
	// Delete v1 ...
	Delete(groupName, ruleName string) error
	CreateOrUpdate(groupName, ruleName, content string) error
	// BatchRemove v2 ...
	BatchRemove(groupName string) error
	BatchSet(groupName string, rules []db.ClusterRuleItem) error
}

func GetComponent

func GetComponent(storeType int, params *Params) (Component, error)

GetComponent 每个 storeType 下 instance 和 cluster 是一对一的关系 一个 cluster 下会有多个 instance 使用不同的 storeType

type OperatorRule

type OperatorRule struct {
	Record      string            `yaml:"record,omitempty"`
	Alert       string            `yaml:"alert,omitempty"`
	Expr        string            `yaml:"expr"`
	For         string            `yaml:"for,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
}

func (OperatorRule) Conversion

func (r OperatorRule) Conversion() monitoringv1.Rule

type OperatorRuleGroup

type OperatorRuleGroup struct {
	Name                    string         `yaml:"name"`
	Interval                string         `yaml:"interval,omitempty"`
	Rules                   []OperatorRule `yaml:"rules"`
	PartialResponseStrategy string         `yaml:"partial_response_strategy,omitempty"`
}

type OperatorRuleGroups

type OperatorRuleGroups struct {
	Groups []OperatorRuleGroup `yaml:"groups,omitempty"`
}

type Params

type Params struct {
	InstanceID int
	// file system
	RulePath string
	// k8s configmap
	ClusterId int
	Namespace string
	Configmap string
	// k8s operator
	PrometheusOperator string
}

Jump to

Keyboard shortcuts

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