Documentation
¶
Index ¶
- Variables
- func DefaultOpniReceiver(embeddedServerHook string) *config.Receiver
- func DefaultSubTreeLabel() string
- func DefaultSubTreeValues() []string
- func NewDefaultRoutingTree(embeddedServerHook string) *config.Config
- func NewDefaultRoutingTreeRoot(embeddedServerHook string) *config.Config
- func NewOpniAlarmLabels(conditionId string) (map[string]string, error)
- func NewOpniMetricsSubtree() *config.Route
- func NewOpniNamespacedSubTree(namespace string, defaultValues ...string) (*config.Route, []*config.Receiver)
- func NewOpniSeverityLabels(title, body, severity string) (map[string]string, error)
- func NewOpniSubRoutingTree() (*config.Route, []*config.Receiver)
- func NewOpniSubRoutingTreeWithDefaultValue(namespace, value string) (*config.Route, *config.Receiver)
- func NewOpniSubRoutingTreeWithValue(rl rateLimitingConfig, opniConfigs []config.OpniReceiver, ...) (*config.Route, *config.Receiver)
- 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) MarshalYAML() ([]byte, error)
- 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) SetNamespaceSpec(namespace, routeId string, specs *alertingv1.FullAttachedEndpoints) error
- func (o *OpniRouterV1) SyncExternalConfig(content []byte) error
- func (o *OpniRouterV1) UnmarshalYAML(unmarshal func(interface{}) error) 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 RoutingIdentifer
Constants ¶
This section is empty.
Variables ¶
View Source
var OpniMetricsSubRoutingTreeId config.Matchers = []*labels.Matcher{ shared.OpniMetricsSubRoutingTreeMatcher, }
View Source
var OpniSubRoutingTreeId config.Matchers = []*labels.Matcher{ shared.OpniSubRoutingTreeMatcher, }
Functions ¶
func DefaultOpniReceiver ¶
func DefaultSubTreeLabel ¶
func DefaultSubTreeLabel() string
func DefaultSubTreeValues ¶
func DefaultSubTreeValues() []string
! values must be returned sorted in a deterministic order
func NewDefaultRoutingTree ¶
func NewDefaultRoutingTreeRoot ¶
This needs to expand all labels, due to assumptions we make about external backends like AiOps pushing messages to the severity tree
func NewOpniMetricsSubtree ¶
this subtree connects to cortex
func NewOpniSeverityLabels ¶
func NewOpniSubRoutingTree ¶
returns the subtree & the default receivers contains the setup for broadcasting and conditions
Types ¶
type OpniRouterV1 ¶
type OpniRouterV1 struct { HookEndpoint string `yaml:"hookEndpoint,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(hookEndpoint string) *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) MarshalYAML ¶
func (o *OpniRouterV1) MarshalYAML() ([]byte, error)
func (*OpniRouterV1) Merge ¶
func (o *OpniRouterV1) Merge(_ OpniRouting) (OpniRouting, error)
func (*OpniRouterV1) SetDefaultNamespaceConfig ¶
func (o *OpniRouterV1) SetDefaultNamespaceConfig(endpoints []*alertingv1.AlertEndpoint) error
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) UnmarshalYAML ¶
func (o *OpniRouterV1) UnmarshalYAML(unmarshal func(interface{}) error) error
func (*OpniRouterV1) UpdateEndpoint ¶
func (o *OpniRouterV1) UpdateEndpoint(id string, spec *alertingv1.AlertEndpoint) error
type OpniRouting ¶
type OpniRouting interface { ProductionConfigSyncer RoutingIdentifer yaml.Unmarshaler MarshalYAML() ([]byte, error) 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
func NewDefaultOpniRoutingWithOverrideHook ¶
func NewDefaultOpniRoutingWithOverrideHook(hook string) 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 }
WIP
Click to show internal directories.
Click to hide internal directories.