Documentation
¶
Overview ¶
Package processor contains the core logic for processing alerts and updating the health map metrics.
Index ¶
- Constants
- func NewProcessor(cfg ProcessorConfig, healthMapMetrics, componentsMetrics prom.MetricSet, ...) (*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 []model.LabelSet, timestamp time.Time) []model.LabelSet
- 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 ProcessorConfig
- type SrcType
Constants ¶
View Source
const ( ClusterHealthComponentsMap = "cluster_health_components_map" AlertNameLabelKey = "alertname" )
Variables ¶
This section is empty.
Functions ¶
func NewProcessor ¶
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 model.LabelSet // Identifying labels of the source
GroupId string // Group ID of the component
Health HealthValue // Health value of the component
Silenced string // Whether the alert is silenced or not
}
ComponentHealthMap represents mapping of a specific source to the component's health.
func MapAlerts ¶
func MapAlerts(alerts []model.LabelSet) []ComponentHealthMap
MapAlerts maps prometheus alerts to component health maps.
func (ComponentHealthMap) Labels ¶
func (c ComponentHealthMap) Labels() model.LabelSet
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 []common.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_" )
func ParseHealthValue ¶ added in v1.2.0
func ParseHealthValue(s string) HealthValue
func (HealthValue) String ¶ added in v1.2.0
func (h HealthValue) String() string
type Interval ¶
func MetricsIntervals ¶
func MetricsIntervals(rangeVector prom.RangeVector) []Interval
type ProcessorConfig ¶ added in v1.2.0
Click to show internal directories.
Click to hide internal directories.