Documentation ¶
Overview ¶
Package processor contains the core logic for processing alerts and updating the health map metrics.
Index ¶
- func NewProcessor(healthMapMetrics, componentsMetrics prom.MetricSet, interval time.Duration, ...) (*processor, error)
- type Change
- type ChangeSet
- type ComponentHealthMap
- type ComponentRank
- type GroupMatcher
- type GroupedInterval
- type GroupsCollection
- func (gc *GroupsCollection) AddGroup(g *GroupMatcher)
- func (gc *GroupsCollection) ProcessAlertsBatch(alerts []prom.Alert, timestamp time.Time) []prom.Alert
- func (gc *GroupsCollection) ProcessIntervalsBatch(intervals []Interval) []GroupedInterval
- func (gc *GroupsCollection) PruneGroups(t time.Time)
- func (gc *GroupsCollection) UpdateGroupUUIDs(healthMapRV prom.RangeVector)
- type HealthValue
- type Interval
- type LabelsMatcher
- type SrcType
- type ValueMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChangeSet ¶
type ChangeSet []Change
func MetricsChanges ¶
func MetricsChanges(rangeVector prom.RangeVector) ChangeSet
MetricsChanges returns a list of changes in the alerts.
The changes are grouped by the timestamp of the change and sorted by the timestamp.
type ComponentHealthMap ¶
type ComponentHealthMap struct { Layer string // Layer of the component Component string // Component name SrcType SrcType // Type of the source (alert, cluster_operator_condition) SrcLabels map[string]string // Identifying labels of the source GroupId string // Group ID of the component Health HealthValue // Health value of the component }
ComponentHealthMap represents mapping of a specific source to the component's health.
func MapAlerts ¶
func MapAlerts(alerts []prom.Alert) []ComponentHealthMap
MapAlerts maps prometheus alerts to component health maps.
func (ComponentHealthMap) Labels ¶
func (c ComponentHealthMap) Labels() map[string]string
Labels to be exported for the mapping.
type ComponentRank ¶
func BuildComponentRanks ¶
func BuildComponentRanks() []ComponentRank
type GroupMatcher ¶
type GroupMatcher struct { GroupID string RootGroupID string Start model.Time Modified model.Time End model.Time Distance float64 Matchers []labelsSubsetMatcher }
func (GroupMatcher) String ¶
func (g GroupMatcher) String() string
type GroupedInterval ¶
type GroupedInterval struct { Interval GroupMatcher *GroupMatcher }
func (GroupedInterval) String ¶
func (gi GroupedInterval) String() string
type GroupsCollection ¶
type GroupsCollection struct {
Groups []*GroupMatcher
}
func (*GroupsCollection) AddGroup ¶
func (gc *GroupsCollection) AddGroup(g *GroupMatcher)
func (*GroupsCollection) ProcessAlertsBatch ¶
func (*GroupsCollection) ProcessIntervalsBatch ¶
func (gc *GroupsCollection) ProcessIntervalsBatch(intervals []Interval) []GroupedInterval
func (*GroupsCollection) PruneGroups ¶
func (gc *GroupsCollection) PruneGroups(t time.Time)
PruneGroups removes groups that can't be matched anymore.
It calculates the threshold based on the provided time and removes groups.
func (*GroupsCollection) UpdateGroupUUIDs ¶
func (gc *GroupsCollection) UpdateGroupUUIDs(healthMapRV prom.RangeVector)
type HealthValue ¶
type HealthValue int
HealthValue represents the health value of the component.
const ( Healthy HealthValue = 0 Warning HealthValue = 1 Critical HealthValue = 2 SrcLabelPrefix = "src_" )
type Interval ¶
func MetricsIntervals ¶
func MetricsIntervals(rangeVector prom.RangeVector) []Interval
type LabelsMatcher ¶
type ValueMatcher ¶
type ValueMatcher interface { Matches(value string) bool Equals(other ValueMatcher) bool }
ValueMatcher represents a matcher for a specific value.
Multiple implementations are provided for different types of matchers.