cortex

package
v0.9.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

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 ConstructFiltersFromMap(in map[string]string) string

func ConstructIdLabelsForRecordingRule

func ConstructIdLabelsForRecordingRule(alertId string) map[string]string

func ConstructRecordingRuleName

func ConstructRecordingRuleName(prefix, typeName string) string

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 ParseCortexPayloadBytes(inputPayload []byte) ([]gjson.Result, error)

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 RuleIdFromUuid(id string) string

func TimeDurationToPromStr

func TimeDurationToPromStr(t time.Duration) string

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

type MatrixRef lo.Tuple3[int, int, *model.SamplePair]

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

type MockCortexPayload struct {
	webhook.Message
}

func NewSimpleMockAlertManagerPayloadFromAnnotations

func NewSimpleMockAlertManagerPayloadFromAnnotations(ann map[string]string) *MockCortexPayload

Jump to

Keyboard shortcuts

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