Documentation
¶
Index ¶
- Variables
- func FinalizerReceiver(cfg *config.WebhookConfig) *config.Receiver
- func NewNamespaceLeaf(rl rateLimitingConfig, opniConfigs []config.OpniReceiver, ...) (*config.Route, *config.Receiver)
- func NewNamespaceTree(namespace string, defaultValues ...RouteValues) (*config.Route, []*config.Receiver)
- func NewNotificationLeaf(namespace string, value RouteValues) (*config.Route, *config.Receiver)
- func NewOpniMetricsSubtree() *config.Route
- func NewOpniSubRoutingTree() (*config.Route, []*config.Receiver)
- func NewRootNode(cfg *config.WebhookConfig) *config.Config
- func NewRoutingTree(cfg *config.WebhookConfig) *config.Config
- func NotificationSubTreeLabel() string
- type Config
- type FinalizerConfig
- type GlobalConfig
- type NotificationConfg
- type OpniRouterV1
- func (o *OpniRouterV1) BuildConfig() (*config.Config, error)
- func (o *OpniRouterV1) Clone() OpniRouting
- func (o *OpniRouterV1) DeleteEndpoint(id string) error
- func (o *OpniRouterV1) HasLabels(routingId string) []*labels.Matcher
- func (o *OpniRouterV1) HasReceivers(routingId string) []string
- func (o *OpniRouterV1) Merge(_ OpniRouting) (OpniRouting, error)
- func (o *OpniRouterV1) Search(map[string]string) []*config.Route
- func (o *OpniRouterV1) SetDefaultNamespaceConfig(endpoints []*alertingv1.AlertEndpoint) error
- func (o *OpniRouterV1) SetDefaultReceiver(cfg config.WebhookConfig)
- func (o *OpniRouterV1) SetNamespaceSpec(namespace, routeId string, specs *alertingv1.FullAttachedEndpoints) error
- func (o *OpniRouterV1) SyncExternalConfig(content []byte) error
- func (o *OpniRouterV1) UpdateEndpoint(id string, spec *alertingv1.AlertEndpoint) error
- func (o *OpniRouterV1) Walk(map[string]string, func(int, *config.Route) error) error
- type OpniRouting
- type ProductionConfigSyncer
- type RouteValues
- type RoutingIdentifer
- type SubtreeConfig
Constants ¶
This section is empty.
Variables ¶
var ( OpniSubRoutingTreeMatcher *labels.Matcher = &labels.Matcher{ Type: labels.MatchEqual, Name: alertingv1.RoutingPropertyDatasource, Value: "", } OpniMetricsSubRoutingTreeMatcher *labels.Matcher = &labels.Matcher{ Type: labels.MatchEqual, Name: alertingv1.RoutingPropertyDatasource, Value: wellknown.CapabilityMetrics, } OpniSeverityTreeMatcher *labels.Matcher = &labels.Matcher{ Type: labels.MatchNotEqual, Name: message.NotificationPropertySeverity, Value: "", } )
var ( DefaultConfig = Config{ GlobalConfig: GlobalConfig{ GroupWait: lo.ToPtr(model.Duration(60 * time.Second)), RepeatInterval: lo.ToPtr(model.Duration(5 * time.Hour)), }, SubtreeConfig: SubtreeConfig{ GroupWait: lo.ToPtr(model.Duration(60 * time.Second)), RepeatInterval: lo.ToPtr(model.Duration(5 * time.Hour)), }, FinalizerConfig: FinalizerConfig{ InitialDelay: time.Second * 10, ThrottlingDuration: time.Minute * 1, RepeatInterval: time.Hour * 5, }, NotificationConfg: NotificationConfg{}, } )
var OpniMetricsSubRoutingTreeId config.Matchers = []*labels.Matcher{ OpniMetricsSubRoutingTreeMatcher, }
var OpniSubRoutingTreeId config.Matchers = []*labels.Matcher{ OpniSubRoutingTreeMatcher, }
Functions ¶
func FinalizerReceiver ¶ added in v0.9.0
func FinalizerReceiver(cfg *config.WebhookConfig) *config.Receiver
func NewNamespaceLeaf ¶ added in v0.9.0
func NewNamespaceLeaf( rl rateLimitingConfig, opniConfigs []config.OpniReceiver, matchers []*labels.Matcher, receiverId string, ) (*config.Route, *config.Receiver)
new namespace matcher
func NewNamespaceTree ¶ added in v0.9.0
func NewNotificationLeaf ¶ added in v0.9.0
func NewOpniMetricsSubtree ¶
this subtree connects to cortex
func NewOpniSubRoutingTree ¶
returns the subtree & the default receivers contains the setup for broadcasting and conditions
func NewRootNode ¶ added in v0.9.0
func NewRootNode(cfg *config.WebhookConfig) *config.Config
This needs to expand all labels, due to assumptions we make about external backends like AiOps pushing messages to the severity tree
func NewRoutingTree ¶ added in v0.9.0
func NewRoutingTree(cfg *config.WebhookConfig) *config.Config
func NotificationSubTreeLabel ¶ added in v0.9.0
func NotificationSubTreeLabel() string
Types ¶
type Config ¶ added in v0.11.0
type Config struct { GlobalConfig `yaml:"global", json:"global"` SubtreeConfig `yaml:"subtree", json:"subtree"` FinalizerConfig `yaml:"finalizer", json:"finalizer"` NotificationConfg `yaml:"notification", json:"notification"` }
type FinalizerConfig ¶ added in v0.11.0
type GlobalConfig ¶ added in v0.11.0
type NotificationConfg ¶ added in v0.11.0
type NotificationConfg struct { }
type OpniRouterV1 ¶
type OpniRouterV1 struct { DefaultReceiver config.WebhookConfig `yaml:"defaultReceiver,omitempty" json:"hookEndpoint,omitempty"` // Contains an AlertManager config not created and managed by Opni SyncedConfig *config.Config `yaml:"embeddedConfig,omitempty" json:"embeddedConfig,omitempty"` // defaultNamespaceValue -> endpointId -> OpniConfig DefaultNamespaceConfigs defaultNamespaceConfigs `yaml:"defaultNamespaceConfigs,omitempty" json:"defaultNamespaceConfigs,omitempty"` // namespace -> routeId -> endpointId -> OpniConfig NamespacedSpecs namespacedSpecs `yaml:"namespacedSpecs,omitempty" json:"namespacedSpecs,omitempty"` // namespace -> routeId -> rateLimitingConfig NamespacedRateLimiting namespaceRateLimiting `yaml:"namespacedRateLimiting,omitempty" json:"namespacedRateLimiting,omitempty"` }
indexes using endpointId for scalability
func NewOpniRouterV1 ¶
func NewOpniRouterV1(defaultRevc config.WebhookConfig) *OpniRouterV1
func (*OpniRouterV1) BuildConfig ¶
func (o *OpniRouterV1) BuildConfig() (*config.Config, error)
func (*OpniRouterV1) Clone ¶
func (o *OpniRouterV1) Clone() OpniRouting
func (*OpniRouterV1) DeleteEndpoint ¶
func (o *OpniRouterV1) DeleteEndpoint(id string) error
func (*OpniRouterV1) HasLabels ¶
func (o *OpniRouterV1) HasLabels(routingId string) []*labels.Matcher
func (*OpniRouterV1) HasReceivers ¶
func (o *OpniRouterV1) HasReceivers(routingId string) []string
func (*OpniRouterV1) Merge ¶
func (o *OpniRouterV1) Merge(_ OpniRouting) (OpniRouting, error)
func (*OpniRouterV1) SetDefaultNamespaceConfig ¶
func (o *OpniRouterV1) SetDefaultNamespaceConfig(endpoints []*alertingv1.AlertEndpoint) error
func (*OpniRouterV1) SetDefaultReceiver ¶ added in v0.9.0
func (o *OpniRouterV1) SetDefaultReceiver(cfg config.WebhookConfig)
func (*OpniRouterV1) SetNamespaceSpec ¶
func (o *OpniRouterV1) SetNamespaceSpec(namespace, routeId string, specs *alertingv1.FullAttachedEndpoints) error
func (*OpniRouterV1) SyncExternalConfig ¶
func (o *OpniRouterV1) SyncExternalConfig(content []byte) error
func (*OpniRouterV1) UpdateEndpoint ¶
func (o *OpniRouterV1) UpdateEndpoint(id string, spec *alertingv1.AlertEndpoint) error
type OpniRouting ¶
type OpniRouting interface { ProductionConfigSyncer RoutingIdentifer SetDefaultNamespaceConfig(endps []*alertingv1.AlertEndpoint) error SetNamespaceSpec(namespace string, routeId string, specs *alertingv1.FullAttachedEndpoints) error // When an already attached endpoint is updated, propagate updates to the routing tree UpdateEndpoint(id string, spec *alertingv1.AlertEndpoint) error // When an already attached endpoint is delete, propagate all deletions to the routing tree DeleteEndpoint(endpointId string) error // Converts OpniRouting to a valid AlertManager config // Returns a NotFound error if the a route to update or delete is not found // Returns a Conflict error if we try to insert a duplicate config, unique up to its keys BuildConfig() (*config.Config, error) Clone() OpniRouting }
OpniRouting Responsible for handling the mapping of ids to configured endpoints, including indexing external configs
func NewDefaultOpniRouting ¶
func NewDefaultOpniRouting() OpniRouting
type ProductionConfigSyncer ¶
type ProductionConfigSyncer interface { // Walks the tree of routes in the config, calling the given function Walk(map[string]string, func(depth int, r *config.Route) error) error // Returns the routes that match the given labels Search(labels map[string]string) []*config.Route // Merges two OpniRouting objects (also includes merging plain AlertManager configs for users) Merge(other OpniRouting) (OpniRouting, error) // Converts a valid AlertManager config to OpniRouting // Returns an FailedPrecondition error if the config cannot be unmarshalled, // Returns an InternalServerError if the config is invalid SyncExternalConfig(content []byte) error }
type RouteValues ¶ added in v0.9.0
RouteValues (receiver name, rate limiting config)
func NotificationSubTreeValues ¶ added in v0.9.0
func NotificationSubTreeValues() []RouteValues
! values must be returned sorted in a deterministic order
these are used by the router to catch eveyrthing that is not an explicit alarm that is also part of opni, i.e. plain text notifications