cortex

package
v0.9.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 12 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(alertName, alertId string) map[string]string

func ConstructRecordingRuleName

func ConstructRecordingRuleName(prefix, typeName string) string

func CortexRuleIdFromUuid

func CortexRuleIdFromUuid(id string) string

func ParseAlertManagerWebhookPayload

func ParseAlertManagerWebhookPayload(annotations []gjson.Result) ([]*alertingv1.TriggerAlertsRequest, []error)

func ParseCortexPayloadBytes

func ParseCortexPayloadBytes(inputPayload []byte) ([]gjson.Result, error)

func TimeDurationToPromStr

func TimeDurationToPromStr(t time.Duration) string

Types

type MockCortexPayload

type MockCortexPayload struct {
	webhook.Message
}

func NewSimpleMockAlertManagerPayloadFromAnnotations

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

type RuleGroupYAMLv2

type RuleGroupYAMLv2 struct {
	Name     string             `yaml:"name"`
	Interval prommodel.Duration `yaml:"interval,omitempty"`
	Rules    []rulefmt.Rule     `yaml:"rules"`
}

Marshals to the same format a cortex rule group expects

func NewCortexAlertingRule

func NewCortexAlertingRule(
	alertId,
	alertName string,
	opniLabels,
	opniAnnotations map[string]string,
	info alertingv1.IndexableMetric,
	interval *time.Duration,
	rule metrics.AlertRuleBuilder,
) (*RuleGroupYAMLv2, error)

Jump to

Keyboard shortcuts

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