Documentation ¶
Index ¶
- Variables
- func ConstructFiltersFromMap(in map[string]string) string
- func ConstructIdLabelsForRecordingRule(alertId string) map[string]string
- func ConstructRecordingRuleName(prefix, typeName string) string
- func NewPrometheusAlertingRule(alertId, _ string, opniLabels, opniAnnotations map[string]string, ...) (*rulefmt.RuleGroup, error)
- func ParseAlertManagerWebhookPayload(annotations []gjson.Result) ([]*alertingv1.TriggerAlertsRequest, []error)
- func ParseCortexPayloadBytes(inputPayload []byte) ([]gjson.Result, error)
- func ReducePrometheusMatrix(matrix *model.Matrix) []*alertingv1.ActiveWindow
- func RuleIdFromUuid(id string) string
- func TimeDurationToPromStr(t time.Duration) string
- type MatrixHeap
- type MatrixRef
- type MockCortexPayload
Constants ¶
This section is empty.
Variables ¶
View Source
var OpniDisconnect *alertingv1.AlertCondition = &alertingv1.AlertCondition{ Name: "Disconnected Opni Agent {{ .agentId }} ", Description: "Opni agent {{ .agentId }} has been disconnected for more than {{ .timeout }}", Labels: []string{"opni", "agent", "system"}, Severity: alertingv1.OpniSeverity_Critical, AlertType: &alertingv1.AlertTypeDetails{Type: &alertingv1.AlertTypeDetails_System{}}, }
View Source
var RequiredCortexWebhookAnnotationIdentifiers = []string{"conditionId"}
Functions ¶
func ConstructFiltersFromMap ¶
func NewPrometheusAlertingRule ¶ added in v0.9.0
func NewPrometheusAlertingRule( alertId, _ string, opniLabels, opniAnnotations map[string]string, info alertingv1.IndexableMetric, interval *time.Duration, rule metrics.AlertRuleBuilder, ) (*rulefmt.RuleGroup, error)
func ParseAlertManagerWebhookPayload ¶
func ParseAlertManagerWebhookPayload(annotations []gjson.Result) ([]*alertingv1.TriggerAlertsRequest, []error)
func ParseCortexPayloadBytes ¶
func ReducePrometheusMatrix ¶ added in v0.9.0
func ReducePrometheusMatrix(matrix *model.Matrix) []*alertingv1.ActiveWindow
`ALERTS` can have several root causes for causing the active alerting rule to fire; prometheus store each root cause as a separate synthetic timeseries. This function reduces the matrix of synthetic timeseries into a single array of sorted active windows !! Assumes the input matrix is non-nil
func RuleIdFromUuid ¶ added in v0.9.0
func TimeDurationToPromStr ¶
Types ¶
type MatrixHeap ¶ added in v0.9.0
type MatrixHeap []MatrixRef
Implements the container/heap.Heap interface
func (MatrixHeap) Len ¶ added in v0.9.0
func (h MatrixHeap) Len() int
func (MatrixHeap) Less ¶ added in v0.9.0
func (h MatrixHeap) Less(i, j int) bool
func (*MatrixHeap) Pop ¶ added in v0.9.0
func (h *MatrixHeap) Pop() any
func (*MatrixHeap) Push ¶ added in v0.9.0
func (h *MatrixHeap) Push(x any)
func (MatrixHeap) Swap ¶ added in v0.9.0
func (h MatrixHeap) Swap(i, j int)
type MatrixRef ¶ added in v0.9.0
MatrixRef A : Refers to the index of a specific metric in the matrix B : Refers to the position in the metric.Values array to process
type MockCortexPayload ¶
func NewSimpleMockAlertManagerPayloadFromAnnotations ¶
func NewSimpleMockAlertManagerPayloadFromAnnotations(ann map[string]string) *MockCortexPayload
Click to show internal directories.
Click to hide internal directories.