alertinhibit

package
v0.0.0-...-9970c52 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InhibitMatcher

type InhibitMatcher struct {
	SourceMatchers []*Matcher
	TargetMatchers []*Matcher
	Equal          []string
}

func NewMatchers

func NewMatchers() ([]*InhibitMatcher, error)

func (*InhibitMatcher) Match

func (m *InhibitMatcher) Match() (*InhibitWhere, error)

type InhibitRule

type InhibitRule struct {
	SourceMatchers []string `mapstructure:"source_matchers" json:"source_matchers"`
	TargetMatchers []string `mapstructure:"target_matchers" json:"target_matchers"`
	Equal          []string `mapstructure:"equal" json:"equal"`
}

InhibitRule 抑制规则结构体

func NewInhibitRules

func NewInhibitRules() ([]*InhibitRule, error)

type InhibitWhere

type InhibitWhere struct {
	SourcesWhere []*Where
	TargetsWhere []*Where
	Equal        []string
}

type Matcher

type Matcher struct {
	Name  string `json:"name"`  // 标签名
	Value string `json:"value"` // 标签值
	Type  string `json:"type"`  // 操作符: =, !=, =~, !~
	Equal []string
}

func ParseMatcher

func ParseMatcher(input string) (*Matcher, error)

ParseMatcher 将字符串解析为 Matcher 结构体

func TransformStringsToMatchers

func TransformStringsToMatchers(inputs []string, equal []string) ([]*Matcher, error)

TransformStringsToMatchers 批量转换字符串数组

func (*Matcher) GetCondition

func (m *Matcher) GetCondition() (string, interface{}, error)

GetCondition 返回 GORM 的 Where 条件片段和参数 返回示例: ("alertname = ?", "节点磁盘空间不足") 或者针对 JSON: ("labels->>? = ?", "$.\"device\"", "eth0")

type Where

type Where struct {
	ColumnExpr string
	Value      any
}

Jump to

Keyboard shortcuts

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