Documentation ¶
Index ¶
- Constants
- 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, ...) (ruleGroup *rulefmt.RuleGroup, metadata map[string]string, err error)
- func ReducePrometheusMatrix(matrix *model.Matrix) []*alertingv1.ActiveWindow
- func RuleIdFromUuid(id string) string
- func TimeDurationToPromStr(t time.Duration) string
- type MatrixHeap
- type MatrixRef
Constants ¶
View Source
const ( MetadataCortexNamespace = "opni.io/cortex-rule-namespace" MetadataCortexGroup = "opni.io/cortex-rule-group" MetadataCortexRuleName = "opni.io/cortex-rule-name" )
Variables ¶
This section is empty.
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, ) (ruleGroup *rulefmt.RuleGroup, metadata map[string]string, err 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 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)
Click to show internal directories.
Click to hide internal directories.